drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject [3/7] drill git commit: DRILL-3484: Error with no-argument functions when the cast empty strings to null option is set
Date Tue, 04 Aug 2015 22:11:23 GMT
DRILL-3484: Error with no-argument functions when the cast empty strings to null option is
set


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

Branch: refs/heads/master
Commit: ae2a45c8f803affcbbb021105c1a30cba4bd4213
Parents: 891fa1a
Author: Jason Altekruse <altekrusejason@gmail.com>
Authored: Thu Jul 9 16:48:53 2015 -0700
Committer: Jason Altekruse <altekrusejason@gmail.com>
Committed: Tue Aug 4 08:49:02 2015 -0700

----------------------------------------------------------------------
 .../exec/expr/fn/FunctionImplementationRegistry.java |  1 +
 .../src/test/java/org/apache/drill/TestBugFixes.java | 15 +++++++++++++++
 2 files changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/ae2a45c8/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionImplementationRegistry.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionImplementationRegistry.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionImplementationRegistry.java
index dee93c1..695cd46 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionImplementationRegistry.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/FunctionImplementationRegistry.java
@@ -111,6 +111,7 @@ public class FunctionImplementationRegistry implements FunctionLookupContext
{
     String funcName = functionCall.getName();
     if (optionManager != null
         && optionManager.getOption(ExecConstants.CAST_TO_NULLABLE_NUMERIC).bool_val
+        && functionCall.args.size() > 0
         && CastFunctions.isReplacementNeeded(functionCall.args.get(0).getMajorType().getMinorType(),
                                              funcName)) {
       org.apache.drill.common.types.TypeProtos.DataMode dataMode =

http://git-wip-us.apache.org/repos/asf/drill/blob/ae2a45c8/exec/java-exec/src/test/java/org/apache/drill/TestBugFixes.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/TestBugFixes.java b/exec/java-exec/src/test/java/org/apache/drill/TestBugFixes.java
index 7aed478..b5ed1d1 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/TestBugFixes.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/TestBugFixes.java
@@ -78,6 +78,21 @@ public class TestBugFixes extends BaseTestQuery {
     }
   }
 
+  /**
+   * This test is not checking results because the bug fixed only appears with functions
taking no arguments.
+   * I could alternatively use something like the now() function, but this still would be
hard to write
+   * result verification for. The important aspect of the test is that it verifies that the
previous IOOB
+   * does not occur. The various no-argument functions should be verified in other ways.
+   */
+  @Test
+  public void Drill3484() throws Exception {
+    try {
+      test("alter SYSTEM set `drill.exec.functions.cast_empty_string_to_null` = true;");
+      test("select random() from sys.drillbits");
+    } finally {
+      test("alter SYSTEM set `drill.exec.functions.cast_empty_string_to_null` = false;");
+    }
+  }
 
   @Test (expected = UserException.class)
   // Should be "Failure while parsing sql. Node [rel#26:Subset#6.LOGICAL.ANY([]).[]] could
not be implemented;".


Mime
View raw message