danielcweeks commented on code in PR #17284:
URL: https://github.com/apache/iceberg/pull/17284#discussion_r3884517703
##########
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:
I think we actually have an issue here. We need to test to see if we hit
EOF here to ensure that we've read the full content. If there's a concern that
the file size is stale, we shouldn't blindly copy the bytes and assume it's
correct. We should at lease validate we're at the end of the stream.
I'm not sure what we can do if the file size is smaller than the recorded
length because we'll hit the IO exception, but we should at minimum handle the
case that it's longer.
--
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]