rdblue commented on a change in pull request #1097:
URL: https://github.com/apache/iceberg/pull/1097#discussion_r436844034



##########
File path: hive/src/test/java/org/apache/iceberg/hive/HiveTableTest.java
##########
@@ -238,6 +238,19 @@ public void testExistingTableUpdate() throws TException {
         .map(Types.NestedField::name)
         .collect(Collectors.toList());
     Assert.assertEquals(icebergColumns, hiveColumns);
+
+    // Add two columns with different types, then verify we could delete the 
first column in hive metastore
+    // as hive conf METASTORE_DISALLOW_INCOMPATIBLE_COL_TYPE_CHANGES was set 
to false. If this was set to true,
+    // an InvalidOperationException would thrown in method 
MetaStoreUtils#throwExceptionIfIncompatibleColTypeChange()
+    int columnCount = icebergTable.schema().columns().size();
+    icebergTable.updateSchema()
+            .addColumn("str1", Types.StringType.get())
+            .addColumn("int1", Types.IntegerType.get())
+            .commit();
+    Assert.assertEquals("2 columns added", columnCount + 2, 
icebergTable.schema().columns().size());
+
+    icebergTable.updateSchema().deleteColumn("str1").commit();
+    Assert.assertEquals("1 column deleted", columnCount + 1, 
icebergTable.schema().columns().size());

Review comment:
       Tests for new cases should be in separate test methods instead of tacked 
on to existing tests. Also, can you change the assertions to check the full 
table schema instead of just sizes? It should be something like this:
   
   ```java
   Schema expectedSchema = new Schema(...);
   icebergTable.updateSchema()
       ...
       .commit();
   
   Assert.assertEquals("Schema should match expected", expected.asStruct(), 
icebergTable.schema().asStruct());
   ```




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

Reply via email to