deniskuzZ commented on code in PR #5715:
URL: https://github.com/apache/hive/pull/5715#discussion_r2075491083


##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergMetaHook.java:
##########
@@ -947,6 +951,23 @@ private void 
handleAddColumns(org.apache.hadoop.hive.metastore.api.Table hmsTabl
     updateSchema.commit();
   }
 
+  private void handleDropColumn(org.apache.hadoop.hive.metastore.api.Table 
hmsTable) throws MetaException {
+    List<FieldSchema> hmsCols = hmsTable.getSd().getCols();
+    List<FieldSchema> icebergCols = 
HiveSchemaUtil.convert(icebergTable.schema());
+
+    List<FieldSchema> removedCols = HiveSchemaUtil.getSchemaDiff(icebergCols, 
hmsCols, false).getMissingFromSecond();
+    if (removedCols.isEmpty()) {
+      return;
+    }
+
+    transaction = icebergTable.newTransaction();
+    updateSchema = transaction.updateSchema();

Review Comment:
   why do you need to populate `updateSchema` var? Ideally, it should be 
completely removed together with `updatePartitionSpec`
   ````
   transaction.updateSchema()
       .deleteColumn(removedCols.get(0).getName());
       .commit();
   ````



-- 
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: gitbox-unsubscr...@hive.apache.org

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