You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2021/02/01 22:06:52 UTC
[GitHub] [iceberg] pvary commented on a change in pull request #2121: Hive: New test case for writing to the table with projection and column specification
pvary commented on a change in pull request #2121:
URL: https://github.com/apache/iceberg/pull/2121#discussion_r568173029
##########
File path: mr/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergStorageHandlerWithEngine.java
##########
@@ -335,6 +335,25 @@ public void testInsertFromSelectWithOrderBy() throws IOException {
HiveIcebergTestUtils.validateData(table, records, 0);
}
+ @Test
+ public void testInsertFromSelectWithProjection() throws IOException {
+ Assume.assumeTrue("Tez write is not implemented yet", executionEngine.equals("mr"));
+
+ Table table = testTables.createTable(shell, "customers", HiveIcebergStorageHandlerTestUtils.CUSTOMER_SCHEMA,
+ fileFormat, ImmutableList.of());
+ testTables.createTable(shell, "orders", ORDER_SCHEMA, fileFormat, ORDER_RECORDS);
+
+ shell.executeStatement(
+ "INSERT INTO customers (customer_id, last_name) SELECT distinct(customer_id), 'test' FROM orders");
+
+ List<Record> expected = TestHelper.RecordsBuilder.newInstance(HiveIcebergStorageHandlerTestUtils.CUSTOMER_SCHEMA)
+ .add(0L, null, "test")
+ .add(1L, null, "test")
+ .build();
+
+ HiveIcebergTestUtils.validateData(table, new ArrayList<>(expected), 0);
Review comment:
`HiveIcebergTestUtils.validateData` uses in place sort to compare the actual and the expected records. This is needed of other uses of the method, so I just recreated a new list for the test case
----------------------------------------------------------------
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org