Repository: incubator-drill Updated Branches: refs/heads/master cca3cec18 -> fb2091ad7
Fix DRILL-926: Index out of bound exception when creating outgoing filter record batch when incoming SV mode is NONE. Project: http://git-wip-us.apache.org/repos/asf/incubator-drill/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-drill/commit/0ad7124e Tree: http://git-wip-us.apache.org/repos/asf/incubator-drill/tree/0ad7124e Diff: http://git-wip-us.apache.org/repos/asf/incubator-drill/diff/0ad7124e Branch: refs/heads/master Commit: 0ad7124eff4cb3ee5c6b68070c9f78ae7dcc7aac Parents: cca3cec Author: Aman Sinha <[email protected]> Authored: Fri Jun 6 17:27:47 2014 -0700 Committer: Aman Sinha <[email protected]> Committed: Fri Jun 6 17:33:54 2014 -0700 ---------------------------------------------------------------------- .../drill/exec/physical/impl/filter/FilterTemplate2.java | 9 +++++---- .../main/java/org/apache/drill/exec/record/RecordBatch.java | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/0ad7124e/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/filter/FilterTemplate2.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/filter/FilterTemplate2.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/filter/FilterTemplate2.java index a823049..5b0b88f 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/filter/FilterTemplate2.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/filter/FilterTemplate2.java @@ -60,7 +60,9 @@ public abstract class FilterTemplate2 implements Filterer{ } public void filterBatch(int recordCount){ - outgoingSelectionVector.allocateNew(recordCount); + if (! outgoingSelectionVector.allocateNew(recordCount)) { + throw new UnsupportedOperationException("Unable to allocate filter batch"); + } switch(svMode){ case NONE: filterBatchNoSV(recordCount); @@ -89,10 +91,9 @@ public abstract class FilterTemplate2 implements Filterer{ private void filterBatchNoSV(int recordCount){ int svIndex = 0; - for(char i =0; i < recordCount; i++){ - + for(int i = 0; i < recordCount; i++){ if(doEval(i, 0)){ - outgoingSelectionVector.setIndex(svIndex, i); + outgoingSelectionVector.setIndex(svIndex, (char)i); svIndex++; } } http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/0ad7124e/exec/java-exec/src/main/java/org/apache/drill/exec/record/RecordBatch.java ---------------------------------------------------------------------- diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/record/RecordBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/record/RecordBatch.java index 662deb6..75b9b0c 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/record/RecordBatch.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/record/RecordBatch.java @@ -33,7 +33,7 @@ import org.apache.drill.exec.vector.ValueVector; */ public interface RecordBatch extends VectorAccessible { - /* max batch size, limited by 2-byte-lentgh in SV2 : 65536 = 2^16 */ + /* max batch size, limited by 2-byte-length in SV2 : 65536 = 2^16 */ public static final int MAX_BATCH_SIZE = 65536; /**
