You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by ad...@apache.org on 2015/09/27 21:18:47 UTC

[1/3] drill git commit: DRILL-3784: simple Jdbc program fails with NoClassDefFoundError

Repository: drill
Updated Branches:
  refs/heads/master 846df965e -> b9afcf8fa


DRILL-3784: simple Jdbc program fails with NoClassDefFoundError


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

Branch: refs/heads/master
Commit: bb111addb1f702044c70d48c9dd05a5c001b15d6
Parents: 846df96
Author: adeneche <ad...@gmail.com>
Authored: Tue Sep 22 20:34:19 2015 -0700
Committer: adeneche <ad...@gmail.com>
Committed: Sun Sep 27 12:17:35 2015 -0700

----------------------------------------------------------------------
 exec/jdbc-all/pom.xml | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/bb111add/exec/jdbc-all/pom.xml
----------------------------------------------------------------------
diff --git a/exec/jdbc-all/pom.xml b/exec/jdbc-all/pom.xml
index 4a7c57d..68ce38a 100644
--- a/exec/jdbc-all/pom.xml
+++ b/exec/jdbc-all/pom.xml
@@ -305,7 +305,6 @@
               <exclude>com.twitter:*</exclude>
               <exclude>javax.inject:*</exclude>
               <exclude>com.beust:*</exclude>
-              <exclude>org.codehaus.jackson:*</exclude>
               <exclude>jline:*</exclude>
               <exclude>io.netty:netty:jar:3.7.0.Final</exclude>
               <exclude>org.xerial.snappy:*</exclude>


[3/3] drill git commit: DRILL-3596: Allow only () or (, 1) for LEAD and LAG window functions as input parameters

Posted by ad...@apache.org.
DRILL-3596: Allow only (<expression>) or (<expression>, 1) for LEAD and LAG window functions as input parameters

this closes #128


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

Branch: refs/heads/master
Commit: b9afcf8fa92e432d31bddf0c8c88b09a51b4102d
Parents: f7ce86d
Author: adeneche <ad...@gmail.com>
Authored: Mon Aug 24 13:37:25 2015 -0700
Committer: adeneche <ad...@gmail.com>
Committed: Sun Sep 27 12:17:55 2015 -0700

----------------------------------------------------------------------
 .../sql/parser/UnsupportedOperatorsVisitor.java | 35 ++++++++++++++++++++
 .../physical/impl/window/TestWindowFrame.java   | 23 +++++++++++++
 2 files changed, 58 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/b9afcf8f/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 67793bf..188095c 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
@@ -17,6 +17,7 @@
  */
 package org.apache.drill.exec.planner.sql.parser;
 
+import org.apache.calcite.sql.SqlNumericLiteral;
 import org.apache.drill.exec.ExecConstants;
 import org.apache.drill.exec.exception.UnsupportedOperatorCollector;
 import org.apache.drill.exec.ops.QueryContext;
@@ -118,6 +119,40 @@ public class UnsupportedOperatorsVisitor extends SqlShuttle {
                   "See Apache Drill JIRA: DRILL-3182");
               throw new UnsupportedOperationException();
             }
+
+            // DRILL-3596: we only allow (<column-name>) or (<column-name>, 1)
+            final String functionName = function.getOperator().getName().toUpperCase();
+            if ("LEAD".equals(functionName) || "LAG".equals(functionName)) {
+              boolean supported = true;
+              if (function.operandCount() > 2) {
+                // we don't support more than 2 arguments
+                supported = false;
+              } else if (function.operandCount() == 2) {
+                SqlNode operand = function.operand(1);
+                if (operand instanceof SqlNumericLiteral) {
+                  SqlNumericLiteral offsetLiteral = (SqlNumericLiteral) operand;
+                  try {
+                    if (offsetLiteral.intValue(true) != 1) {
+                      // we don't support offset != 1
+                      supported = false;
+                    }
+                  } catch (AssertionError e) {
+                    // we only support offset as an integer
+                    supported = false;
+                  }
+                } else {
+                  // we only support offset as a numeric literal
+                  supported = false;
+                }
+              }
+
+              if (!supported) {
+                unsupportedOperatorCollector.setException(SqlUnsupportedException.ExceptionType.FUNCTION,
+                  "Function " + functionName + " only supports (<value expression>) or (<value expression>, 1)\n" +
+                    "See Apache DRILL JIRA: DRILL-3596");
+                throw new UnsupportedOperationException();
+              }
+            }
           }
         }
       }

http://git-wip-us.apache.org/repos/asf/drill/blob/b9afcf8f/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 ba66fce..92c27d7 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
@@ -306,6 +306,29 @@ public class TestWindowFrame extends BaseTestQuery {
   }
 
   @Test
+  public void testLeadParams() throws Exception {
+    // make sure we only support default arguments for LEAD/LAG functions
+    final String query = "SELECT %s OVER(PARTITION BY col7 ORDER BY col8) FROM dfs_test.`%s/window/3648.parquet`";
+
+    test(query, "LEAD(col8, 1)", TEST_RES_PATH);
+    test(query, "LAG(col8, 1)", TEST_RES_PATH);
+
+    try {
+      test(query, "LEAD(col8, 2)", TEST_RES_PATH);
+      fail("query should fail");
+    } catch (UserRemoteException e) {
+      assertEquals(ErrorType.UNSUPPORTED_OPERATION, e.getErrorType());
+    }
+
+    try {
+      test(query, "LAG(col8, 2)", TEST_RES_PATH);
+      fail("query should fail");
+    } catch (UserRemoteException e) {
+      assertEquals(ErrorType.UNSUPPORTED_OPERATION, e.getErrorType());
+    }
+  }
+
+  @Test
   public void testPartitionNtile() {
     Partition partition = new Partition(12);
 


[2/3] drill git commit: DRILL-3822: Have PathScanner use own, not thread-context, class loader.

Posted by ad...@apache.org.
DRILL-3822:  Have PathScanner use own, not thread-context, class loader.

this closes #166


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

Branch: refs/heads/master
Commit: f7ce86d3941af0559c4149718b6b9a523e4c9ab2
Parents: bb111ad
Author: dbarclay <db...@maprtech.com>
Authored: Tue Sep 22 18:04:45 2015 -0700
Committer: adeneche <ad...@gmail.com>
Committed: Sun Sep 27 12:17:45 2015 -0700

----------------------------------------------------------------------
 .../java/org/apache/drill/common/util/PathScanner.java   | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/f7ce86d3/common/src/main/java/org/apache/drill/common/util/PathScanner.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/drill/common/util/PathScanner.java b/common/src/main/java/org/apache/drill/common/util/PathScanner.java
index 9ee487b..65bf9b5 100644
--- a/common/src/main/java/org/apache/drill/common/util/PathScanner.java
+++ b/common/src/main/java/org/apache/drill/common/util/PathScanner.java
@@ -130,10 +130,11 @@ public class PathScanner {
    *           to scan for (relative to specified class loaders' classpath roots)
    * @param  returnRootPathname  whether to collect classpath root portion of
    *           URL for each resource instead of full URL of each resource
-   * @param  classLoaders  set of class loaders in which to look up resource;
-   *           none (empty array) to specify to use current thread's context
-   *           class loader and {@link Reflections}'s class loader
-   * @return  ...; empty set if none
+   * @param  classLoaders  not currently used (was: "set of class loaders in
+   *           which to look up resource; none (empty array) to specify to use
+   *           current thread's context class loader and {@link Reflections}'s
+   *           class loader")
+   * @returns  ...; empty set if none
    */
   public static Set<URL> forResource(final String resourcePathname,
                                      final boolean returnRootPathname,
@@ -142,7 +143,7 @@ public class PathScanner {
                  resourcePathname);
     final Set<URL> resultUrlSet = Sets.newHashSet();
 
-    final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+    final ClassLoader classLoader = PathScanner.class.getClassLoader();
     try {
       final Enumeration<URL> resourceUrls =
           classLoader.getResources(resourcePathname);