varun-lakhyani commented on code in PR #17284:
URL: https://github.com/apache/iceberg/pull/17284#discussion_r3885430939


##########
core/src/main/java/org/apache/iceberg/io/EagerInputFile.java:
##########
@@ -60,12 +72,40 @@ public boolean exists() {
 
   @Override
   public SeekableInputStream newStream() {
-    byte[] bytes = new byte[(int) fileSize];
+    byte[] bytes = new byte[(int) length];
     try (SeekableInputStream src = delegate.newStream()) {
       IOUtil.readFully(src, bytes, 0, bytes.length);

Review Comment:
   Done 
https://github.com/apache/iceberg/pull/17284/commits/b700403822482dbdaec1773aa3080b08cd82eea4,
 
   smaller than recorded length already throws in IOUtil in readFully, now 
Eager throws for file length greater than recorded length by checking an 
additional byte which should be -1 for EOF. (It doesn't need a new request as 
it's served from already opened stream).
   Fails in Eager.newStream itself rather than passing truncated to parquet 
readers.
   It also adds a small unit test @kevinjqliu 



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