rdblue commented on a change in pull request #2121:
URL: https://github.com/apache/iceberg/pull/2121#discussion_r568184958
##########
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:
Doesn't this leak the concern about sorting outside of the method? I
would rather have the array copy happen defensively inside the method.
----------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]