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

kangkaisen 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 5c4bba1  [Bug] Fix isnull(null) analyze error (#4094)
5c4bba1 is described below

commit 5c4bba107ea6193cb7e7e9e681c2c697267fcf37
Author: HangyuanLiu <460660...@qq.com>
AuthorDate: Wed Jul 22 20:04:39 2020 +0800

    [Bug] Fix isnull(null) analyze error (#4094)
---
 .../org/apache/doris/analysis/IsNullPredicate.java |  4 +-
 .../apache/doris/analysis/IsNullPredicateTest.java | 47 ++++++++++++++++++++++
 2 files changed, 49 insertions(+), 2 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/IsNullPredicate.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/IsNullPredicate.java
index a402623..740ea36 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/IsNullPredicate.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/IsNullPredicate.java
@@ -103,10 +103,10 @@ public class IsNullPredicate extends Predicate {
         super.analyzeImpl(analyzer);
         if (isNotNull) {
             fn = getBuiltinFunction(
-                    analyzer, IS_NOT_NULL, collectChildReturnTypes(), 
Function.CompareMode.IS_IDENTICAL);
+                    analyzer, IS_NOT_NULL, collectChildReturnTypes(), 
Function.CompareMode.IS_INDISTINGUISHABLE);
         } else {
             fn = getBuiltinFunction(
-                    analyzer, IS_NULL, collectChildReturnTypes(), 
Function.CompareMode.IS_IDENTICAL);
+                    analyzer, IS_NULL, collectChildReturnTypes(), 
Function.CompareMode.IS_INDISTINGUISHABLE);
         }
         Preconditions.checkState(fn != null, "tupleisNull fn == NULL");
 
diff --git 
a/fe/src/test/java/org/apache/doris/analysis/IsNullPredicateTest.java 
b/fe/src/test/java/org/apache/doris/analysis/IsNullPredicateTest.java
new file mode 100644
index 0000000..3f0bb48
--- /dev/null
+++ b/fe/src/test/java/org/apache/doris/analysis/IsNullPredicateTest.java
@@ -0,0 +1,47 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// // or more contributor license agreements.  See the NOTICE file
+// // distributed with this work for additional information
+// // regarding copyright ownership.  The ASF licenses this file
+// // to you under the Apache License, Version 2.0 (the
+// // "License"); you may not use this file except in compliance
+// // with the License.  You may obtain a copy of the License at
+// //
+// //   http://www.apache.org/licenses/LICENSE-2.0
+// //
+// // Unless required by applicable law or agreed to in writing,
+// // software distributed under the License is distributed on an
+// // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// // KIND, either express or implied.  See the License for the
+// // specific language governing permissions and limitations
+// // under the License.
+
+package org.apache.doris.analysis;
+
+import mockit.Mocked;
+import org.apache.doris.common.AnalysisException;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class IsNullPredicateTest {
+    @Mocked
+    Analyzer analyzer;
+
+    @Test
+    public void testNullParam() {
+        IsNullPredicate isNullPredicate = new IsNullPredicate(new 
NullLiteral(), false);
+
+        try {
+            isNullPredicate.analyzeImpl(analyzer);
+        } catch (AnalysisException e) {
+            Assert.fail();
+        }
+        
+        IsNullPredicate isNotNullPredicate = new IsNullPredicate(new 
NullLiteral(), true);
+
+        try {
+            isNotNullPredicate.analyzeImpl(analyzer);
+        } catch (AnalysisException e) {
+            Assert.fail();
+        }
+    }
+}


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

Reply via email to