diff --git a/java/core/src/java/org/apache/orc/impl/RecordReaderUtils.java b/java/core/src/java/org/apache/orc/impl/RecordReaderUtils.java index 1b76f0d8b7..d249a2cc21 100644 --- a/java/core/src/java/org/apache/orc/impl/RecordReaderUtils.java +++ b/java/core/src/java/org/apache/orc/impl/RecordReaderUtils.java @@ -770,32 +770,32 @@ void readRanges(FSDataInputStream file, boolean allocateDirect, double extraByte } static ChunkReader create(BufferChunk from, BufferChunk to) { - long f = Long.MAX_VALUE; - long e = Long.MIN_VALUE; + long start = Long.MAX_VALUE; + long end = Long.MIN_VALUE; - long cf = Long.MAX_VALUE; - long ef = Long.MIN_VALUE; + long currentStart = Long.MAX_VALUE; + long currentEnd = Long.MIN_VALUE; long reqBytes = 0L; BufferChunk current = from; while (current != to.next) { - f = Math.min(f, current.getOffset()); - e = Math.max(e, current.getEnd()); - if (ef == Long.MIN_VALUE || current.getOffset() <= ef) { - cf = Math.min(cf, current.getOffset()); - ef = Math.max(ef, current.getEnd()); + start = Math.min(start, current.getOffset()); + end = Math.max(end, current.getEnd()); + if (currentEnd == Long.MIN_VALUE || current.getOffset() <= currentEnd) { + currentStart = Math.min(currentStart, current.getOffset()); + currentEnd = Math.max(currentEnd, current.getEnd()); } else { - reqBytes += ef - cf; - cf = current.getOffset(); - ef = current.getEnd(); + reqBytes += currentEnd - currentStart; + currentStart = current.getOffset(); + currentEnd = current.getEnd(); } current = (BufferChunk) current.next; } - reqBytes += ef - cf; + reqBytes += currentEnd - currentStart; if (reqBytes > IOUtils.MAX_ARRAY_SIZE) { throw new IllegalArgumentException("invalid reqBytes value " + reqBytes + ",out of bounds " + IOUtils.MAX_ARRAY_SIZE); } - long readBytes = e - f; + long readBytes = end - start; if (readBytes > IOUtils.MAX_ARRAY_SIZE) { throw new IllegalArgumentException("invalid readBytes value " + readBytes + ",out of bounds " + IOUtils.MAX_ARRAY_SIZE); }