Github user ConeyLiu commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20026#discussion_r158220107
  
    --- Diff: 
core/src/main/java/org/apache/spark/io/NioBufferedFileInputStream.java ---
    @@ -91,7 +92,12 @@ public synchronized int read(byte[] b, int offset, int 
len) throws IOException {
     
       @Override
       public synchronized int available() throws IOException {
    -    return byteBuffer.remaining();
    +    int n = byteBuffer.remaining();
    +    long avail = fileChannel.size() - fileChannel.position();
    +    long total = avail + n;
    +    return avail > (Long.MAX_VALUE - n)
    +      ? Integer.MAX_VALUE : total > Integer.MAX_VALUE
    +      ? Integer.MAX_VALUE : (int)total;
    --- End diff --
    
    This also shoule be fixed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to