You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by bo...@apache.org on 2020/07/01 11:08:15 UTC
[drill] branch master updated: DRILL-7759: Code compilation
exception for queries containing (untyped) NULL
This is an automated email from the ASF dual-hosted git repository.
bohdan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/drill.git
The following commit(s) were added to refs/heads/master by this push:
new 46dabbd DRILL-7759: Code compilation exception for queries containing (untyped) NULL
46dabbd is described below
commit 46dabbdfcb9ea90c49503ed84a25d8d71cdc283b
Author: Bohdan Kazydub <bo...@gmail.com>
AuthorDate: Fri Jun 26 17:42:14 2020 +0300
DRILL-7759: Code compilation exception for queries containing (untyped) NULL
---
.../apache/drill/exec/expr/EvaluationVisitor.java | 7 ++-
.../java/org/apache/drill/TestUntypedNull.java | 9 ++++
.../exec/store/parquet/TestParquetComplex.java | 1 +
.../src/test/resources/physical_untyped_null.json | 56 ++++++++++++++++++++++
4 files changed, 72 insertions(+), 1 deletion(-)
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/EvaluationVisitor.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/EvaluationVisitor.java
index 773b4be..18b7af4 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/EvaluationVisitor.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/EvaluationVisitor.java
@@ -1039,7 +1039,12 @@ public class EvaluationVisitor {
JBlock earlyExit = null;
if (arg.isOptional()) {
- earlyExit = eval._if(arg.getIsSet().eq(JExpr.lit(1)).cand(arg.getValue().ne(JExpr.lit(1))))._then();
+ JExpression expr1 = arg.getIsSet().eq(JExpr.lit(1));
+ // UntypedNullHolder does not have `value` field
+ if (arg.getMinorType() != TypeProtos.MinorType.NULL) {
+ expr1 = expr1.cand(arg.getValue().ne(JExpr.lit(1)));
+ }
+ earlyExit = eval._if(expr1)._then();
if (e == null) {
e = arg.getIsSet();
} else {
diff --git a/exec/java-exec/src/test/java/org/apache/drill/TestUntypedNull.java b/exec/java-exec/src/test/java/org/apache/drill/TestUntypedNull.java
index a3d8532..bb707c6 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/TestUntypedNull.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/TestUntypedNull.java
@@ -240,5 +240,14 @@ public class TestUntypedNull extends ClusterTest {
.baselineValuesForSingleColumn(null, null, null, null, null)
.go();
}
+
+ @Test
+ public void testValueIsNotReferencedOnUntypedNullHolderInstance() throws Exception {
+ testBuilder()
+ .physicalPlanFromFile("physical_untyped_null.json")
+ .unOrdered()
+ .expectsEmptyResultSet()
+ .go();
+ }
}
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestParquetComplex.java b/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestParquetComplex.java
index b496f33..92f3d39 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestParquetComplex.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestParquetComplex.java
@@ -197,6 +197,7 @@ public class TestParquetComplex extends BaseTestQuery {
.run();
}
+ @Test
public void testReadRepeatedDecimals() throws Exception {
JsonStringArrayList<BigDecimal> ints = new JsonStringArrayList<>();
diff --git a/exec/java-exec/src/test/resources/physical_untyped_null.json b/exec/java-exec/src/test/resources/physical_untyped_null.json
new file mode 100644
index 0000000..f27a024
--- /dev/null
+++ b/exec/java-exec/src/test/resources/physical_untyped_null.json
@@ -0,0 +1,56 @@
+{
+ "head" : {
+ "version" : 1,
+ "generator" : {
+ "type" : "ExplainHandler",
+ "info" : ""
+ },
+ "type" : "APACHE_DRILL_PHYSICAL",
+ "options" : [ ],
+ "queue" : 0,
+ "hasResourcePlan" : false,
+ "resultMode" : "EXEC"
+ },
+ "graph" : [ {
+ "pop" : "mock-scan",
+ "@id" : 5,
+ "url": "http://apache.org",
+ "entries":[
+ {"records": 100, "types": [
+ {"name": "order_date", "type": "DATE", "mode": "OPTIONAL"},
+ {"name": "order_type", "type": "VARCHAR", "mode": "REQUIRED"}
+ ]}
+ ]
+ }, {
+ "pop" : "filter",
+ "@id" : 4,
+ "child" : 5,
+ "expr" : "booleanAnd(booleanOr(booleanAnd(istrue(less_than_or_equal_to(`order_date`, cast( 1517443200000 as DATE)) ) , NULL) , isnottrue(less_than_or_equal_to(`order_date`, cast( 1517443200000 as DATE)) ) ) , booleanOr(istrue(booleanOr(equal(`order_date`, cast( 1588291200000 as DATE)) , equal(`order_date`, cast( 1575158400000 as DATE)) ) ) , booleanAnd(NULL, isnottrue(booleanOr(equal(`order_date`, cast( 1588291200000 as DATE)) , equal(`order_date`, cast( 1575158400000 as DATE)) ) ) ) ) ) "
+ }, {
+ "pop" : "selection-vector-remover",
+ "@id" : 3,
+ "child" : 4
+ }, {
+ "pop" : "project",
+ "@id" : 2,
+ "exprs" : [ {
+ "ref" : "`type`",
+ "expr" : "`order_type`"
+ } ],
+ "child" : 3,
+ "outputProj" : false
+ }, {
+ "pop" : "project",
+ "@id" : 1,
+ "exprs" : [ {
+ "ref" : "`type`",
+ "expr" : "`type`"
+ } ],
+ "child" : 2,
+ "outputProj" : true
+ }, {
+ "pop" : "screen",
+ "@id" : 0,
+ "child" : 1
+ } ]
+}
\ No newline at end of file