pvary commented on a change in pull request #3912:
URL: https://github.com/apache/iceberg/pull/3912#discussion_r791386294



##########
File path: 
mr/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergStorageHandlerNoScan.java
##########
@@ -773,4 +773,52 @@ public void testDropHiveTableWithoutUnderlyingTable() 
throws IOException {
   private String 
getCurrentSnapshotForHiveCatalogTable(org.apache.iceberg.Table icebergTable) {
     return ((BaseMetastoreTableOperations) ((BaseTable) 
icebergTable).operations()).currentMetadataLocation();
   }
+
+  @Test
+  public void testCreateTableWithIdentifierIds() {
+    TableIdentifier tableIdentifier = TableIdentifier.of("default", 
"customers");
+    shell.executeStatement(
+        String.format("CREATE EXTERNAL TABLE %s ( " +
+                "  c1 INT, " +
+                "  c2 STRING, " +
+                "  c3 STRUCT<c4:STRING, c5:STRING> " +
+                ") " +
+                "PARTITIONED BY (c6 STRING) " +
+                "STORED BY 
'org.apache.iceberg.mr.hive.HiveIcebergStorageHandler' %s " +
+                "TBLPROPERTIES (" +
+                "  '%s' = '%s'," +
+                "  '%s' = '%s'" +
+                ")",
+            tableIdentifier,
+            testTables.locationForCreateTableSQL(tableIdentifier),
+            InputFormatConfig.IDENTIFIER_FIELD_NAMES, "c1,c2",
+            InputFormatConfig.CATALOG_NAME, testTables.catalogName()));
+
+    org.apache.iceberg.Table table = testTables.loadTable(tableIdentifier);
+    Assert.assertEquals(ImmutableSet.of(1, 2), 
table.schema().identifierFieldIds());
+  }
+
+  @Test
+  public void testCreateTableWithIdentifierIdsError() {
+    TableIdentifier tableIdentifier = TableIdentifier.of("default", 
"customers");
+    Assert.assertThrows(
+        "Cannot add field c4 as an identifier field: must not in nested field",
+        IllegalArgumentException.class,
+        () -> shell.executeStatement(
+            String.format("CREATE EXTERNAL TABLE %s ( " +

Review comment:
       And this too 




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to