hsiang-c commented on code in PR #5544:
URL: https://github.com/apache/iceberg/pull/5544#discussion_r1650529269


##########
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveTableOperations.java:
##########
@@ -137,7 +163,47 @@ protected String tableName() {
 
   @Override
   public FileIO io() {
-    return fileIO;
+    if (encryptionManager == null) {
+      encryptionManager = encryption();
+    }
+
+    if (!encryptedTable) {
+      return fileIO;
+    }
+
+    if (encryptingFileIO != null) {
+      return encryptingFileIO;
+    }
+
+    encryptingFileIO = EncryptingFileIO.combine(fileIO, encryptionManager);
+    return encryptingFileIO;
+  }
+
+  @Override
+  public EncryptionManager encryption() {
+    if (encryptionManager != null) {
+      return encryptionManager;
+    }
+
+    if (encryptionKeyId == null) {
+      encryptionPropsFromHms();

Review Comment:
   This LGTM now.
   
   The previous approach (i.e. call the `dekLength()` in 
`BaseMetastoreTableOperations`) will only set `encryptionDekLength` on the 
write path (the `writeNewMetadataFile` method). Therefore, Hive Catalog readers 
get the default -1 value.



-- 
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: issues-unsubscr...@iceberg.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to