lhofhansl commented on a change in pull request #1170:
URL: https://github.com/apache/phoenix/pull/1170#discussion_r599809055
##########
File path:
phoenix-core/src/it/java/org/apache/phoenix/end2end/CsvBulkLoadToolIT.java
##########
@@ -443,7 +445,52 @@ public void testImportOneIndexTable(String tableName,
boolean localIndex) throws
checkIndexTableIsVerified(indexTableName);
}
}
-
+
+ @Test
+ public void testImportWithDifferentPhysicalName() throws Exception {
+ String tableName = generateUniqueName();
+ String indexTableName = String.format("%s_IDX", tableName);
+ Statement stmt = conn.createStatement();
+ stmt.execute("CREATE TABLE " + tableName + "(ID INTEGER NOT NULL
PRIMARY KEY, "
+ + "FIRST_NAME VARCHAR, LAST_NAME VARCHAR)");
+ String ddl = "CREATE INDEX " + indexTableName + " ON " + tableName +
"(FIRST_NAME ASC)";
+ stmt.execute(ddl);
+ String newTableName = LogicalTableNameIT.NEW_TABLE_PREFIX +
generateUniqueName();
+ try (HBaseAdmin admin =
conn.unwrap(PhoenixConnection.class).getQueryServices().getAdmin()) {
+ String snapshotName = new
StringBuilder(tableName).append("-Snapshot").toString();
+ admin.snapshot(snapshotName, TableName.valueOf(tableName));
+ admin.cloneSnapshot(Bytes.toBytes(snapshotName),
Bytes.toBytes(newTableName));
+ }
+ LogicalTableNameIT.renameAndDropPhysicalTable(conn, null, null,
tableName, newTableName);
+
+ FileSystem fs = FileSystem.get(getUtility().getConfiguration());
+ FSDataOutputStream outputStream = fs.create(new
Path("/tmp/input4.csv"));
+ PrintWriter printWriter = new PrintWriter(outputStream);
+ printWriter.println("1,FirstName 1,LastName 1");
+ printWriter.println("2,FirstName 2,LastName 2");
+ printWriter.close();
+
+ CsvBulkLoadTool csvBulkLoadTool = new CsvBulkLoadTool();
+ csvBulkLoadTool.setConf(getUtility().getConfiguration());
+ int
+ exitCode =
+ csvBulkLoadTool
+ .run(new String[] { "--input", "/tmp/input4.csv",
"--table", tableName,
+ "--index-table", indexTableName,
"--zookeeper", zkQuorum });
+ assertEquals(0, exitCode);
+
+ ResultSet rs = stmt.executeQuery("SELECT * FROM " + tableName);
+ assertFalse(rs.next());
Review comment:
This also assume that the Phoenix query planner chooses a specific plan.
Better to hint the query with /*+ NO_INDEX */ if you do not want the index to
be used.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]