drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adene...@apache.org
Subject drill git commit: DRILL-4457: Difference in results returned by window function over BIGINT data
Date Mon, 07 Mar 2016 19:03:17 GMT
Repository: drill
Updated Branches:
  refs/heads/master b67c55383 -> a2fec7869


DRILL-4457: Difference in results returned by window function over BIGINT data

this closes #410


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

Branch: refs/heads/master
Commit: a2fec78695df979e240231cb9d32c7f18274a333
Parents: b67c553
Author: adeneche <adeneche@gmail.com>
Authored: Mon Mar 7 15:08:08 2016 +0100
Committer: adeneche <adeneche@gmail.com>
Committed: Mon Mar 7 18:38:42 2016 +0100

----------------------------------------------------------------------
 .../physical/impl/window/FrameSupportTemplate.java  |  6 +++---
 .../exec/physical/impl/window/TestWindowFrame.java  | 16 ++++++++++++++++
 exec/java-exec/src/test/resources/window/4457.csv   |  3 +++
 3 files changed, 22 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/a2fec786/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/window/FrameSupportTemplate.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/window/FrameSupportTemplate.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/window/FrameSupportTemplate.java
index 1e9d12e..656c75e 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/window/FrameSupportTemplate.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/window/FrameSupportTemplate.java
@@ -112,7 +112,7 @@ public abstract class FrameSupportTemplate implements WindowFramer {
 
       currentRow = processPartition(currentRow);
       if (isPartitionDone()) {
-        cleanPartition();
+        reset();
       }
     }
   }
@@ -126,7 +126,7 @@ public abstract class FrameSupportTemplate implements WindowFramer {
     saveFirstValue(currentRow);
   }
 
-  private void cleanPartition() {
+  private void reset() {
     resetValues();
     for (VectorWrapper<?> vw : internal) {
       if ((vw.getValueVector() instanceof BaseDataValueVector)) {
@@ -177,7 +177,7 @@ public abstract class FrameSupportTemplate implements WindowFramer {
       if (remainingPeers == 0) {
         // because all peer rows share the same frame, we only need to compute and aggregate
the frame once
         if (popConfig.getStart().isCurrent()) {
-          resetValues();
+          reset();
           saveFirstValue(row);
         }
 

http://git-wip-us.apache.org/repos/asf/drill/blob/a2fec786/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/window/TestWindowFrame.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/window/TestWindowFrame.java
b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/window/TestWindowFrame.java
index f8a537b..f5e88d2 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/window/TestWindowFrame.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/window/TestWindowFrame.java
@@ -423,4 +423,20 @@ public class TestWindowFrame extends BaseTestQuery {
     partition.rowAggregated();
     assertEquals(5, partition.ntile(5));
   }
+
+  @Test
+  public void test4457() throws Exception {
+    runSQL(String.format("CREATE TABLE dfs_test.tmp.`4457` AS " +
+      "SELECT columns[0] AS c0, NULLIF(columns[1], 'null') AS c1 " +
+      "FROM dfs_test.`%s/window/4457.csv`", TEST_RES_PATH));
+
+    testBuilder()
+      .sqlQuery("SELECT COALESCE(FIRST_VALUE(c1) OVER(ORDER BY c0 RANGE BETWEEN CURRENT ROW
AND CURRENT ROW), 'EMPTY') AS fv FROM dfs_test.tmp.`4457`")
+      .ordered()
+      .baselineColumns("fv")
+      .baselineValues("a")
+      .baselineValues("b")
+      .baselineValues("EMPTY")
+      .go();
+  }
 }

http://git-wip-us.apache.org/repos/asf/drill/blob/a2fec786/exec/java-exec/src/test/resources/window/4457.csv
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/window/4457.csv b/exec/java-exec/src/test/resources/window/4457.csv
new file mode 100644
index 0000000..8af7ae8
--- /dev/null
+++ b/exec/java-exec/src/test/resources/window/4457.csv
@@ -0,0 +1,3 @@
+1,a
+2,b
+3,null


Mime
View raw message