drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject [2/2] drill git commit: DRILL-3183: Enable compound identifier conversion in window defintion
Date Fri, 26 Jun 2015 18:45:59 GMT
DRILL-3183: Enable compound identifier conversion in window defintion


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

Branch: refs/heads/master
Commit: da17f28678f1dee5c43bdb69582586a79f8b667c
Parents: 80270d1
Author: Hsuan-Yi Chu <hsuanyi@usc.edu>
Authored: Thu Jun 25 14:16:27 2015 -0700
Committer: Jinfeng Ni <jni@apache.org>
Committed: Thu Jun 25 23:02:43 2015 -0700

----------------------------------------------------------------------
 .../sql/parser/CompoundIdentifierConverter.java |  2 +-
 .../apache/drill/exec/TestWindowFunctions.java  | 27 ++++++++++++++++++++
 2 files changed, 28 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/da17f286/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/CompoundIdentifierConverter.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/CompoundIdentifierConverter.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/CompoundIdentifierConverter.java
index fbc5f9b..f9032a4 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/CompoundIdentifierConverter.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/CompoundIdentifierConverter.java
@@ -150,7 +150,7 @@ public class CompoundIdentifierConverter extends SqlShuttle {
   //SqlNodeList orderBy,
   //SqlNode offset,
   //SqlNode fetch,
-    rules.put(SqlSelect.class, R(D, E, D, E, E, E, D, E, D, D));
+    rules.put(SqlSelect.class, R(D, E, D, E, E, E, E, E, D, D));
     rules.put(SqlCreateTable.class, R(D, D, D, E));
     rules.put(SqlCreateView.class, R(D, E, E, D));
     rules.put(SqlDescribeTable.class, R(D, D, E));

http://git-wip-us.apache.org/repos/asf/drill/blob/da17f286/exec/java-exec/src/test/java/org/apache/drill/exec/TestWindowFunctions.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/TestWindowFunctions.java b/exec/java-exec/src/test/java/org/apache/drill/exec/TestWindowFunctions.java
index 5a7a07e..680f35b 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/TestWindowFunctions.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/TestWindowFunctions.java
@@ -19,6 +19,7 @@ package org.apache.drill.exec;
 
 import org.apache.drill.BaseTestQuery;
 import org.apache.drill.common.exceptions.UserException;
+import org.apache.drill.common.util.FileUtils;
 import org.apache.drill.common.util.TestTools;
 import org.apache.drill.exec.work.foreman.SqlUnsupportedException;
 import org.apache.drill.exec.work.foreman.UnsupportedFunctionException;
@@ -316,4 +317,30 @@ public class TestWindowFunctions extends BaseTestQuery {
         .go();
 
   }
+
+  @Test
+  public void testCompoundIdentifierInWindowDefinition() throws Exception {
+    String root = FileUtils.getResourceAsFile("/multilevel/csv/1994/Q1/orders_94_q1.csv").toURI().toString();
+    String query = String.format("SELECT count(*) OVER w as col1, count(*) OVER w as col2
\n" +
+        "FROM dfs_test.`%s` \n" +
+        "WINDOW w AS (PARTITION BY columns[1] ORDER BY columns[0] DESC)", root);
+
+    // Validate the result
+    testBuilder()
+        .sqlQuery(query)
+        .ordered()
+        .baselineColumns("col1", "col2")
+        .baselineValues((long) 1, (long) 1)
+        .baselineValues((long) 1, (long) 1)
+        .baselineValues((long) 1, (long) 1)
+        .baselineValues((long) 1, (long) 1)
+        .baselineValues((long) 1, (long) 1)
+        .baselineValues((long) 1, (long) 1)
+        .baselineValues((long) 1, (long) 1)
+        .baselineValues((long) 1, (long) 1)
+        .baselineValues((long) 1, (long) 1)
+        .baselineValues((long) 1, (long) 1)
+        .build()
+        .run();
+  }
 }


Mime
View raw message