LuciferYang commented on code in PR #45068:
URL: https://github.com/apache/spark/pull/45068#discussion_r1484198113
##########
core/src/main/java/org/apache/spark/io/NioBufferedFileInputStream.java:
##########
@@ -66,32 +66,30 @@ private boolean refill() throws IOException {
nRead = fileChannel.read(byteBuffer);
}
byteBuffer.flip();
- if (nRead < 0) {
- return false;
- }
+ return nRead >= 0;
}
return true;
}
@Override
public synchronized int read() throws IOException {
- if (!refill()) {
- return -1;
+ if (refill()) {
Review Comment:
@mridulm I agree with your viewpoint. Currently, I have transformed the code
from checking `!refill()` to checking `refill()`, and adjusted the
corresponding handling logic (I have not yet updated the PR description). Do
you consider this to be acceptable? If not, I will close this PR.
--
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]