[
https://issues.apache.org/jira/browse/PHOENIX-1791?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14662012#comment-14662012
]
ASF GitHub Bot commented on PHOENIX-1791:
-----------------------------------------
Github user codymarcel commented on a diff in the pull request:
https://github.com/apache/phoenix/pull/105#discussion_r36532442
--- Diff:
phoenix-pherf/src/it/java/org/apache/phoenix/pherf/DataIngestIT.java ---
@@ -144,4 +148,52 @@ public void testRWWorkload() throws Exception {
fail("Failed to load data. An exception was thrown: " +
e.getMessage());
}
}
+
+
+ @Test
+ /**
+ * Validates that Pherf can write data to a Multi-Tenant View in
addition to
+ * standard Phoenix tables.
+ */
+ public void testMultiTenantViewWriteWorkload() throws Exception {
+ // Arrange
+ Scenario scenario =
parser.getScenarioByName("testMTWriteScenario");
+ WorkloadExecutor executor = new WorkloadExecutor();
+ executor.add(new WriteWorkload(util, parser, scenario));
+
+ // Act
+ try {
+ // Wait for data to load up.
+ executor.get();
+ executor.shutdown();
+ } catch (Exception e) {
+ fail("Failed to load data. An exception was thrown: " +
e.getMessage());
+ }
+
+ // Assert
+ assertExpectedNumberOfRecordsWritten(scenario);
+
+ }
+
+ private void assertExpectedNumberOfRecordsWritten(Scenario scenario)
throws Exception,
+ SQLException {
+ Connection connection = util.getConnection(scenario.getTenantId());
+ String sql = "select count(*) from " + scenario.getTableName();
+ Integer count = new JdbcSession(connection).sql(sql).select(new
Outcome<Integer>() {
+ @Override public Integer handle(ResultSet resultSet, Statement
statement)
+ throws SQLException {
+ while (resultSet.next()) {
+ return resultSet.getInt(1);
+ }
+ return null;
+ }
+ });
+ assertNotNull("Could not retrieve count. " + count);
+ assertTrue("Could not query any rows for in " +
scenario.getTableName(), count > 0);
--- End diff --
This assertion is redundant with the one below. The next one is better. I
can remove this one on commit.
> Pherf - Support data creation to multi-tenant views
> ---------------------------------------------------
>
> Key: PHOENIX-1791
> URL: https://issues.apache.org/jira/browse/PHOENIX-1791
> Project: Phoenix
> Issue Type: Bug
> Reporter: Jan Fernando
> Assignee: Jan Fernando
> Priority: Minor
> Labels: Newbie
> Attachments: PHOENIX-1791.patch
>
>
> Pherf currently doesn't allow the data creation phase to use a multi-tenant
> connection write directly to a multi-tenant view. This enhancement would
> allow users to write data directly to multi-tenant views that have the same
> underlying table but where each view has a different set of custom columns.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)