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


##########
iceberg/iceberg-catalog/src/main/java/org/apache/iceberg/hive/HiveTableOperations.java:
##########
@@ -141,15 +206,61 @@ protected void doRefresh() {
     }
 
     refreshFromMetadataLocation(metadataLocation, metadataRefreshMaxRetries);
+    if (tableKeyIdFromHMS != null) {
+      tableKeyId = tableKeyIdFromHMS;
+      encryptionDekLength = (dekLengthFromHMS != null) ?
+          Integer.parseInt(dekLengthFromHMS) :
+          TableProperties.ENCRYPTION_DEK_LENGTH_DEFAULT;
+
+      if (current() != null) {

Review Comment:
   yahh, the test will also fail
   ```
   Caused by: java.lang.NullPointerException: Cannot invoke
     "org.apache.iceberg.TableMetadata.properties()" because "metadata" is null
       at 
org.apache.iceberg.hive.HiveTableOperations.checkIntegrityForEncryption(HiveTableOperations.java:595)
       at 
org.apache.iceberg.hive.HiveTableOperations.doRefresh(HiveTableOperations.java:216)
   ```
   Upstream Iceberg's HiveTableOperations never sees this because in its flow 
the key parameter lands in HMS only at commit time, so current() is always 
populated when doRefresh reaches that code. Hive's create/refresh ordering (and 
multi-table transaction handling built on it) is what exposes the null.



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