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