huaxingao commented on code in PR #14579:
URL: https://github.com/apache/iceberg/pull/14579#discussion_r2530712484


##########
core/src/main/java/org/apache/iceberg/encryption/AesGcmInputFile.java:
##########
@@ -29,8 +29,13 @@ public class AesGcmInputFile implements InputFile {
   private Long encryptedLength;
   private Long plaintextLength;
 
+  /**
+   * @deprecated will be removed in 2.0.0 This API does not receive file 
length, and is therefore
+   *     not safe
+   */
+  @Deprecated
   public AesGcmInputFile(InputFile sourceFile, byte[] dataKey, byte[] 
fileAADPrefix) {
-    this(sourceFile, dataKey, fileAADPrefix, null);
+    throw new IllegalArgumentException("Can't create AesGcmInputFile without 
file length");

Review Comment:
   This introduces a breaking change. Can we change to:
   ```
   this(sourceFile, dataKey, fileAADPrefix, sourceFile.getLength();
   ```
   and move
   ```
   throw new IllegalArgumentException("Can't create AesGcmInputFile without 
file length");
   ```
   to 
   ```
   public AesGcmInputFile(InputFile sourceFile, byte[] dataKey, byte[] 
fileAADPrefix, Long length)
   ```
   ?
   
   



##########
core/src/main/java/org/apache/iceberg/encryption/AesGcmOutputFile.java:
##########
@@ -50,6 +50,6 @@ public String location() {
 
   @Override
   public InputFile toInputFile() {
-    return new AesGcmInputFile(targetFile.toInputFile(), dataKey, 
fileAADPrefix);
+    throw new IllegalStateException("File length unknown, creating an 
AesGcmInputFile is not safe");

Review Comment:
   This introduces a breaking change. Can we keep the current behavior but 
deprecate it in 2.0?



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