From 3b448e004bd22e0cb8f71e18077f142a6535bc45 Mon Sep 17 00:00:00 2001 From: yebukong Date: Tue, 28 Nov 2023 09:26:33 -0800 Subject: [PATCH] ORC-1530: Rename variables in `RecordReaderUtils.ChunkReader#create` ### 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](https://github.com/apache/orc/pull/1662#discussion_r1404534922) ### How was this patch tested? Closes #1664 from yebukong/ORC-1528_rename_variables. Authored-by: yebukong Signed-off-by: Dongjoon Hyun --- .../apache/orc/impl/RecordReaderUtils.java | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) 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); }