You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by ja...@apache.org on 2014/04/23 05:14:45 UTC

[07/10] git commit: DRILL-553: simple query fails sometimes

DRILL-553: simple query fails sometimes

Initialize lastSet variable in NullableVarLength vectors to -1. Also reset when reallocating.


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

Branch: refs/heads/master
Commit: 7b6c7a12576546266bcf5ea109eb71adb0f30cc5
Parents: 43615c8
Author: Steven Phillips <sp...@maprtech.com>
Authored: Mon Apr 21 20:15:39 2014 -0700
Committer: Jacques Nadeau <ja...@apache.org>
Committed: Tue Apr 22 19:29:17 2014 -0700

----------------------------------------------------------------------
 .../main/codegen/templates/NullableValueVectors.java |  3 ++-
 .../java/org/apache/drill/TestExampleQueries.java    | 15 +++++++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/7b6c7a12/exec/java-exec/src/main/codegen/templates/NullableValueVectors.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/NullableValueVectors.java b/exec/java-exec/src/main/codegen/templates/NullableValueVectors.java
index bb692dc..d2209c1 100644
--- a/exec/java-exec/src/main/codegen/templates/NullableValueVectors.java
+++ b/exec/java-exec/src/main/codegen/templates/NullableValueVectors.java
@@ -302,7 +302,7 @@ public final class ${className} extends BaseValueVector implements <#if type.maj
   public final class Mutator implements ValueVector.Mutator, NullableVectorDefinitionSetter{
     
     private int setCount;
-    <#if type.major = "VarLen"> private int lastSet;</#if>
+    <#if type.major = "VarLen"> private int lastSet = -1;</#if>
 
     private Mutator(){
     }
@@ -433,6 +433,7 @@ public final class ${className} extends BaseValueVector implements <#if type.maj
     
     public void reset(){
       setCount = 0;
+      <#if type.major = "VarLen">lastSet = -1;</#if>
     }
     
   }

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/7b6c7a12/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 cbf19ac..191115b 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
@@ -22,6 +22,21 @@ import org.junit.Test;
 public class TestExampleQueries extends BaseTestQuery{
   static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TestExampleQueries.class);
 
+  @Test // see DRILL-553
+  public void testQueryWithNullValues() throws Exception {
+    test("select count(*) from cp.`customer.json` limit 1");
+    test("select count(*) from cp.`customer.json` limit 1");
+    test("select count(*) from cp.`customer.json` limit 1");
+    test("select count(*) from cp.`customer.json` limit 1");
+    test("select count(*) from cp.`customer.json` limit 1");
+    test("select count(*) from cp.`customer.json` limit 1");
+    test("select count(*) from cp.`customer.json` limit 1");
+    test("select count(*) from cp.`customer.json` limit 1");
+    test("select count(*) from cp.`customer.json` limit 1");
+    test("select count(*) from cp.`customer.json` limit 1");
+    test("select count(*) from cp.`customer.json` limit 1");
+  }
+
   @Test
   public void testSelectWithLimit() throws Exception{
     test("select employee_id,  first_name, last_name from cp.`employee.json` order by employee_id limit 5 offset 10");