Skip to content

Commit

Permalink
ORC-1530: Rename variables in RecordReaderUtils.ChunkReader#create
Browse files Browse the repository at this point in the history
### What changes were proposed in this pull request?

rename variables in RecordReaderUtils.ChunkReader#create

### Why are the changes needed?

for easy reading

see [PR 1662](#1662 (comment))

### How was this patch tested?

Closes #1664 from yebukong/ORC-1528_rename_variables.

Authored-by: yebukong <yebukong@qq.com>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
  • Loading branch information
yebukong authored and dongjoon-hyun committed Nov 28, 2023
1 parent fbd1515 commit 3b448e0
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions java/core/src/java/org/apache/orc/impl/RecordReaderUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 3b448e0

Please sign in to comment.