marton-bod commented on a change in pull request #2316:
URL: https://github.com/apache/hive/pull/2316#discussion_r642585589



##########
File path: 
iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergStorageHandlerWithEngine.java
##########
@@ -535,19 +531,45 @@ public void testCTASFromHiveTable() {
         TableProperties.DEFAULT_FILE_FORMAT, fileFormat));
 
     List<Object[]> objects = shell.executeStatement("SELECT * FROM target 
ORDER BY id");
-    Assert.assertEquals(2, objects.size());
-    Assert.assertArrayEquals(new Object[]{1L, "Mike", "HR"}, objects.get(0));
-    Assert.assertArrayEquals(new Object[]{2L, "Linda", "Finance"}, 
objects.get(1));
+    
HiveIcebergTestUtils.validateData(HiveIcebergStorageHandlerTestUtils.CUSTOMER_RECORDS,
+        
HiveIcebergTestUtils.valueForRow(HiveIcebergStorageHandlerTestUtils.CUSTOMER_SCHEMA,
 objects), 0);
+  }
+
+  @Test
+  public void testCTASPartitionedFromHiveTable() throws TException, 
InterruptedException {
+    Assume.assumeTrue(HiveIcebergSerDe.CTAS_EXCEPTION_MSG, testTableType == 
TestTables.TestTableType.HIVE_CATALOG);
+
+    shell.executeStatement("CREATE TABLE source (id bigint, name string) 
PARTITIONED BY (dept string) STORED AS ORC");
+    shell.executeStatement(testTables.getInsertQuery(
+        HiveIcebergStorageHandlerTestUtils.CUSTOMER_RECORDS, 
TableIdentifier.of("default", "source"), false));
+
+    shell.executeStatement(String.format(
+        "CREATE TABLE target PARTITIONED BY (dept, name) " +
+        "STORED BY '%s' TBLPROPERTIES ('%s'='%s') AS SELECT * FROM source",

Review comment:
       Done

##########
File path: 
iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergStorageHandlerWithEngine.java
##########
@@ -556,15 +578,18 @@ public void testCTASFailureRollback() throws IOException {
     testTables.createTable(shell, "source", 
HiveIcebergStorageHandlerTestUtils.CUSTOMER_SCHEMA,
         fileFormat, HiveIcebergStorageHandlerTestUtils.CUSTOMER_RECORDS);
 
-    try {
-      shell.executeStatement(String.format("CREATE TABLE target STORED BY '%s' 
AS SELECT * FROM source",
-          HiveIcebergStorageHandler.class.getName()));
-    } catch (Exception e) {
-      // expected error
-    }
+    String[] partitioningSchemes = {"" /* unpartitioned */, "PARTITIONED BY 
(dept)", "PARTITIONED BY (dept, name)"};
+    for (String partitioning : partitioningSchemes) {
+      try {
+        shell.executeStatement(String.format("CREATE TABLE target %s STORED BY 
'%s' AS SELECT * FROM source",

Review comment:
       Done




-- 
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:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to