This is an automated email from the ASF dual-hosted git repository.

zhaoc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git


The following commit(s) were added to refs/heads/master by this push:
     new a480dec  Do not wrap NULL type tuple (#4245)
a480dec is described below

commit a480dec7a47ad182ed89349af1260b2e81a73967
Author: Lijia Liu <liutang...@yeah.net>
AuthorDate: Tue Aug 11 09:38:42 2020 +0800

    Do not wrap NULL type tuple (#4245)
    
    Do not wrap NULL type expr to IF(TupleIsNull(tids), NULL, expr)
---
 fe/fe-core/src/main/java/org/apache/doris/analysis/CastExpr.java   | 1 +
 .../main/java/org/apache/doris/analysis/TupleIsNullPredicate.java  | 2 +-
 .../src/test/java/org/apache/doris/analysis/SelectStmtTest.java    | 7 +++++++
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/CastExpr.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/CastExpr.java
index 89b5138..3094288 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/CastExpr.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/CastExpr.java
@@ -61,6 +61,7 @@ public class CastExpr extends Expr {
             try {
                 analyze();
             } catch (AnalysisException ex) {
+                LOG.warn("Implicit casts fail", ex);
                 Preconditions.checkState(false,
                         "Implicit casts should never throw analysis 
exception.");
             }
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/TupleIsNullPredicate.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/TupleIsNullPredicate.java
index fedf720..3fb4556 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/TupleIsNullPredicate.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/TupleIsNullPredicate.java
@@ -146,7 +146,7 @@ public class TupleIsNullPredicate extends Predicate {
      * Throws an InternalException if expr evaluation in the BE failed.
      */
     private static boolean requiresNullWrapping(Expr expr, Analyzer analyzer) {
-        if (expr.isConstant()) {
+        if (expr.isConstant() || expr.getType().isNull()) {
             return false;
         }
         return true;
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/analysis/SelectStmtTest.java 
b/fe/fe-core/src/test/java/org/apache/doris/analysis/SelectStmtTest.java
index 396cd35..84c7757 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/analysis/SelectStmtTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/analysis/SelectStmtTest.java
@@ -343,4 +343,11 @@ public class SelectStmtTest {
         String sql = "SELECT * from baseall where k1 > (select min(k1) from 
tbl1 where baseall.k1 = tbl1.k4 and baseall.k2 = tbl1.k2)";
         dorisAssert.query(sql).explainQuery();
     }
+
+    @Test
+    public void testOuterJoinNullUnionView() throws Exception{
+        String sql = "WITH test_view(k) AS(SELECT NULL AS k UNION ALL SELECT 
NULL AS k )\n" +
+                "SELECT v1.k FROM test_view AS v1 LEFT OUTER JOIN test_view AS 
v2 ON v1.k=v2.k";
+        dorisAssert.query(sql).explainQuery();
+    }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to