You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2022/09/30 10:20:40 UTC

[GitHub] [hive] ayushtkn commented on a diff in pull request #3612: HIVE-26576: Alter table calls on Iceberg tables can inadvertently change metadata_location

ayushtkn commented on code in PR #3612:
URL: https://github.com/apache/hive/pull/3612#discussion_r984439963


##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergMetaHook.java:
##########
@@ -386,6 +405,13 @@ private void assertNotCrossTableMetadataLocationChange(Map<String, String> tblPa
                 icebergTable.name(), newMetadataLocation)
         );
       }
+      if (!currentMetadata.metadataFileLocation().equals(newMetadataLocation) &&
+          !context.getProperties().containsKey(MANUAL_ICEBERG_METADATA_LOCATION_CHANGE)) {
+        // If we got here then this is an alter table operation where the table to be changed had an Iceberg commit
+        // meanwhile. The base metadata locations differ, while we know that this wasn't an intentional, manual
+        // metadata_location set by a user. To protect the interim commit we need to refresh the metadata file location.
+        tblParams.put(BaseMetastoreTableOperations.METADATA_LOCATION_PROP, currentMetadata.metadataFileLocation());

Review Comment:
   Good to have a log line here, as a follow up as we discussed we can have some logic to figure out whether it is only a Stats upgrade & if so, make this Alter a NO-OP in future



-- 
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-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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