drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amansi...@apache.org
Subject drill git commit: DRILL-2019: Use correct index for filter evaluation when input to Filter is a SelectionVector2. Add some java doc comments.
Date Mon, 19 Jan 2015 01:56:08 GMT
Repository: drill
Updated Branches:
  refs/heads/master 31d764d4f -> a418af12b


DRILL-2019: Use correct index for filter evaluation when input to Filter is a SelectionVector2.
Add some java doc comments.


Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/a418af12
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/a418af12
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/a418af12

Branch: refs/heads/master
Commit: a418af12bee4df82a0f76bf5cb1ca03a8bcd13e0
Parents: 31d764d
Author: Aman Sinha <asinha@maprtech.com>
Authored: Sun Jan 18 15:24:54 2015 -0800
Committer: Aman Sinha <asinha@maprtech.com>
Committed: Sun Jan 18 17:55:15 2015 -0800

----------------------------------------------------------------------
 .../exec/physical/impl/filter/FilterTemplate2.java   |  2 +-
 .../drill/exec/planner/physical/FilterPrel.java      |  3 +++
 .../org/apache/drill/exec/planner/physical/Prel.java |  7 +++++++
 .../java/org/apache/drill/TestExampleQueries.java    | 15 +++++++++++++++
 4 files changed, 26 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/a418af12/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 bd85418..7e0dd65 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
@@ -81,7 +81,7 @@ public abstract class FilterTemplate2 implements Filterer{
     final int count = recordCount;
     for(int i = 0; i < count; i++){
       char index = incomingSelectionVector.getIndex(i);
-      if(doEval(i, 0)){
+      if(doEval(index, 0)){
         outgoingSelectionVector.setIndex(svIndex, index);
         svIndex++;
       }

http://git-wip-us.apache.org/repos/asf/drill/blob/a418af12/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/FilterPrel.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/FilterPrel.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/FilterPrel.java
index 99d000c..6198d37 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/FilterPrel.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/FilterPrel.java
@@ -70,6 +70,9 @@ public class FilterPrel extends DrillFilterRelBase implements Prel {
     return SelectionVectorMode.NONE_AND_TWO;
   }
 
+  /**
+   * FilterPrel adds an SV2 (TWO_BYTE mode SelectionVector).
+   */
   @Override
   public SelectionVectorMode getEncoding() {
     return SelectionVectorMode.TWO_BYTE;

http://git-wip-us.apache.org/repos/asf/drill/blob/a418af12/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/Prel.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/Prel.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/Prel.java
index 9286bb3..7c63e6a 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/Prel.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/Prel.java
@@ -34,7 +34,14 @@ public interface Prel extends DrillRelNode, Iterable<Prel>{
 
   public <T, X, E extends Throwable> T accept(PrelVisitor<T, X, E> logicalVisitor,
X value) throws E;
 
+  /**
+   * Supported 'encodings' of a Prel indicates what are the acceptable modes of SelectionVector
+   * of its child Prel
+   */
   public SelectionVectorMode[] getSupportedEncodings();
+  /**
+   * A Prel's own SelectionVector mode - i.e whether it generates an SV2, SV4 or None
+   */
   public SelectionVectorMode getEncoding();
   boolean needsFinalColumnReordering();
 

http://git-wip-us.apache.org/repos/asf/drill/blob/a418af12/exec/java-exec/src/test/java/org/apache/drill/TestExampleQueries.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/TestExampleQueries.java b/exec/java-exec/src/test/java/org/apache/drill/TestExampleQueries.java
index 30be58a..f740a1c 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/TestExampleQueries.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/TestExampleQueries.java
@@ -489,4 +489,19 @@ public class TestExampleQueries extends BaseTestQuery{
     test("alter session set `planner.slice_target` = 1; " + streamagg_only + query);
   }
 
+  @Test // DRILL-2019
+  public void testFilterInSubqueryAndOutside() throws Exception {
+    String query1 = "select r_regionkey from (select r_regionkey from cp.`tpch/region.parquet`
o where r_regionkey < 2) where r_regionkey > 2";
+    String query2 = "select r_regionkey from (select r_regionkey from cp.`tpch/region.parquet`
o where r_regionkey < 4) where r_regionkey > 1";
+    int actualRecordCount = 0;
+    int expectedRecordCount = 0;
+
+    actualRecordCount = testSql(query1);
+    assertEquals(expectedRecordCount, actualRecordCount);
+
+    expectedRecordCount = 2;
+    actualRecordCount = testSql(query2);
+    assertEquals(expectedRecordCount, actualRecordCount);
+  }
+
 }


Mime
View raw message