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-3326: When inspecting SELECT-LIST, UnsupportedOperatorsVisitor will dig into AS clause
Date Wed, 24 Jun 2015 20:47:15 GMT
Repository: drill
Updated Branches:
  refs/heads/master 5a34d8194 -> 856b3d2a1


DRILL-3326: When inspecting SELECT-LIST, UnsupportedOperatorsVisitor will dig into AS clause


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

Branch: refs/heads/master
Commit: 856b3d2a1fd083034b1e4a9ed18402d2feb80f56
Parents: 5a34d81
Author: Hsuan-Yi Chu <hsuanyi@usc.edu>
Authored: Fri Jun 19 11:59:51 2015 -0700
Committer: Aman Sinha <asinha@maprtech.com>
Committed: Wed Jun 24 13:24:43 2015 -0700

----------------------------------------------------------------------
 .../sql/parser/UnsupportedOperatorsVisitor.java        |  5 +++++
 .../org/apache/drill/exec/TestWindowFunctions.java     | 13 +++++++++++++
 2 files changed, 18 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/856b3d2a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/UnsupportedOperatorsVisitor.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/UnsupportedOperatorsVisitor.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/UnsupportedOperatorsVisitor.java
index 544a838..0c5afc1 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/UnsupportedOperatorsVisitor.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/parser/UnsupportedOperatorsVisitor.java
@@ -91,6 +91,11 @@ public class UnsupportedOperatorsVisitor extends SqlShuttle {
       // This is used to keep track of the window function which has been defined
       SqlNode definedWindow = null;
       for(SqlNode nodeInSelectList : sqlSelect.getSelectList()) {
+        if(nodeInSelectList.getKind() == SqlKind.AS
+            && (((SqlCall) nodeInSelectList).getOperandList().get(0).getKind() ==
SqlKind.OVER)) {
+          nodeInSelectList = ((SqlCall) nodeInSelectList).getOperandList().get(0);
+        }
+
         if(nodeInSelectList.getKind() == SqlKind.OVER) {
           // Throw exceptions if window functions are disabled
           if(!context.getOptions().getOption(ExecConstants.ENABLE_WINDOW_FUNCTIONS).bool_val)
{

http://git-wip-us.apache.org/repos/asf/drill/blob/856b3d2a/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 1c8b0db..e8daff2 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
@@ -197,6 +197,19 @@ public class TestWindowFunctions extends BaseTestQuery {
     }
   }
 
+  @Test(expected = UnsupportedFunctionException.class) // DRILL-3326
+  public void testWindowWithAlias() throws Exception {
+    try {
+      String query = "explain plan for SELECT sum(n_nationkey) OVER (PARTITION BY n_name
ORDER BY n_name ROWS BETWEEN CURRENT ROW AND 1 FOLLOWING) as col2 \n" +
+          "from cp.`tpch/nation.parquet`";
+
+      test(query);
+    } catch(UserException ex) {
+      throwAsUnsupportedException(ex);
+      throw ex;
+    }
+  }
+
   @Test // DRILL-3188
   public void testWindowFrameEquivalentToDefault() throws Exception {
     final String query1 = "explain plan for select sum(n_nationKey) over(partition by n_nationKey
order by n_nationKey) \n" +


Mime
View raw message