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


##########
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:
   You are right: we can't deprecate this method. In this case the ciphertext 
length isn’t known at this point, and `AesGcmInputFile` requires the length to 
be safe; the old behavior constructed it without a length, which is now 
rejected. So the exception is intentional as a fail‑fast and doesn’t affect the 
normal encryption read path. Since `AesGcmOutputFile.toInputFile()` is not 
supposed to be called directly, I think it's OK to throw Exception here. 



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