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



##########
File path: hive/src/test/java/org/apache/iceberg/hive/HiveTableTest.java
##########
@@ -240,6 +243,37 @@ public void testExistingTableUpdate() throws TException {
     Assert.assertEquals(icebergColumns, hiveColumns);
   }
 
+  @Test
+  public void testColumnTypeChangeInMetastore() throws TException {
+    Table icebergTable = catalog.loadTable(TABLE_IDENTIFIER);
+
+    Schema expectedSchema = new Schema(Types.StructType.of(
+            required(1, "id", Types.LongType.get()),
+            optional(2, "data", Types.LongType.get()),
+            optional(3, "string", Types.StringType.get()),
+            optional(4, "int", Types.IntegerType.get())).fields());
+    // Add columns with different types, then verify we could delete one 
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()
+    icebergTable.updateSchema()
+            .addColumn("data", Types.LongType.get())
+            .addColumn("string", Types.StringType.get())
+            .addColumn("int", Types.IntegerType.get())
+            .commit();
+
+    icebergTable = catalog.loadTable(TABLE_IDENTIFIER);

Review comment:
       It isn't necessary to reload the table. The one in memory is updated 
when an operation commits.




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