You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by sm...@apache.org on 2015/12/03 02:07:21 UTC
[4/4] drill git commit: DRILL-4109 Fix NPE in RecordIterator.
DRILL-4109 Fix NPE in RecordIterator.
Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/d44b889f
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/d44b889f
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/d44b889f
Branch: refs/heads/master
Commit: d44b889ffebbb58939110776795489c052aac786
Parents: 46c47a2
Author: Amit Hadke <am...@gmail.com>
Authored: Tue Nov 24 16:00:16 2015 -0800
Committer: Amit Hadke <am...@gmail.com>
Committed: Wed Dec 2 16:47:32 2015 -0800
----------------------------------------------------------------------
.../apache/drill/exec/record/RecordIterator.java | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/drill/blob/d44b889f/exec/java-exec/src/main/java/org/apache/drill/exec/record/RecordIterator.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/record/RecordIterator.java b/exec/java-exec/src/main/java/org/apache/drill/exec/record/RecordIterator.java
index faa4d83..7b5ec28 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/record/RecordIterator.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/record/RecordIterator.java
@@ -93,7 +93,7 @@ public class RecordIterator implements VectorAccessible {
// Release all batches before current batch. [0 to startBatchPosition).
final Map<Range<Long>,RecordBatchData> oldBatches = batches.subRangeMap(Range.closedOpen(0l, startBatchPosition)).asMapOfRanges();
for (Range<Long> range : oldBatches.keySet()) {
- oldBatches.get(range.lowerEndpoint()).clear();
+ oldBatches.get(range).clear();
}
batches.remove(Range.closedOpen(0l, startBatchPosition));
markedInnerPosition = innerPosition;
@@ -113,8 +113,9 @@ public class RecordIterator implements VectorAccessible {
}
innerPosition = markedInnerPosition;
outerPosition = markedOuterPosition;
- startBatchPosition = batches.getEntry(outerPosition).getKey().lowerEndpoint();
- innerRecordCount = (int)(batches.getEntry(outerPosition).getKey().upperEndpoint() - startBatchPosition);
+ final Range<Long> markedBatchRange = batches.getEntry(outerPosition).getKey();
+ startBatchPosition = markedBatchRange.lowerEndpoint();
+ innerRecordCount = (int)(markedBatchRange.upperEndpoint() - startBatchPosition);
markedInnerPosition = -1;
markedOuterPosition = -1;
}
@@ -133,9 +134,10 @@ public class RecordIterator implements VectorAccessible {
// Get vectors from new position.
container.transferIn(rbdNew.getContainer());
outerPosition = nextOuterPosition;
- startBatchPosition = batches.getEntry(outerPosition).getKey().lowerEndpoint();
+ final Range<Long> markedBatchRange = batches.getEntry(outerPosition).getKey();
+ startBatchPosition = markedBatchRange.lowerEndpoint();
innerPosition = (int)(outerPosition - startBatchPosition);
- innerRecordCount = (int)(batches.getEntry(outerPosition).getKey().upperEndpoint() - startBatchPosition);
+ innerRecordCount = (int)(markedBatchRange.upperEndpoint() - startBatchPosition);
}
/**
@@ -239,7 +241,9 @@ public class RecordIterator implements VectorAccessible {
public int getCurrentPosition() {
Preconditions.checkArgument(initialized);
- Preconditions.checkArgument(innerPosition >= 0 && innerPosition < innerRecordCount);
+ Preconditions.checkArgument(innerPosition >= 0 && innerPosition < innerRecordCount,
+ String.format("innerPosition:%d, outerPosition:%d, innerRecordCount:%d, totalRecordCount:%d",
+ innerPosition, outerPosition, innerRecordCount, totalRecordCount));
return innerPosition;
}