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

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


The following commit(s) were added to refs/heads/master by this push:
     new dfadf4109de [fix](function) incorrect result of 'equal_for_null' 
(#30990)
dfadf4109de is described below

commit dfadf4109de5f373bd27dbee12ef4c5bd9372f71
Author: Jerry Hu <[email protected]>
AuthorDate: Fri Feb 16 18:05:12 2024 +0800

    [fix](function) incorrect result of 'equal_for_null' (#30990)
---
 be/src/vec/functions/comparison_equal_for_null.cpp |  2 +-
 .../data/correctness_p0/test_equal_for_null.out    |  3 ++
 .../correctness_p0/test_equal_for_null.groovy      | 50 ++++++++++++++++++++++
 3 files changed, 54 insertions(+), 1 deletion(-)

diff --git a/be/src/vec/functions/comparison_equal_for_null.cpp 
b/be/src/vec/functions/comparison_equal_for_null.cpp
index cf3384baa0e..561cd8f8aae 100644
--- a/be/src/vec/functions/comparison_equal_for_null.cpp
+++ b/be/src/vec/functions/comparison_equal_for_null.cpp
@@ -76,7 +76,7 @@ public:
             auto right_type_nullable = col_right.type->is_nullable();
             if (!right_type_nullable) {
                 block.get_by_position(result).column =
-                        ColumnVector<UInt8>::create(input_rows_count);
+                        ColumnVector<UInt8>::create(input_rows_count, 0);
             } else {
                 auto const* nullable_right_col =
                         assert_cast<const 
ColumnNullable*>(col_right.column.get());
diff --git a/regression-test/data/correctness_p0/test_equal_for_null.out 
b/regression-test/data/correctness_p0/test_equal_for_null.out
new file mode 100644
index 00000000000..f958424e65c
--- /dev/null
+++ b/regression-test/data/correctness_p0/test_equal_for_null.out
@@ -0,0 +1,3 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !select --
+
diff --git a/regression-test/suites/correctness_p0/test_equal_for_null.groovy 
b/regression-test/suites/correctness_p0/test_equal_for_null.groovy
new file mode 100644
index 00000000000..d2f04e8bdde
--- /dev/null
+++ b/regression-test/suites/correctness_p0/test_equal_for_null.groovy
@@ -0,0 +1,50 @@
+// 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.
+
+suite("test_equal_for_null") {
+    sql """
+        DROP TABLE IF EXISTS `test_equal_for_null_tbl`;
+    """
+
+    sql """
+        CREATE TABLE `test_equal_for_null_tbl` (
+          `k1` int,
+          `k2` varchar(10),
+          `v1` varchar(1024),
+          `pk` int
+        )
+        DISTRIBUTED BY HASH(`pk`) BUCKETS 10
+        PROPERTIES (
+            "replication_allocation" = "tag.location.default: 1"
+        );
+    """
+
+    sql """
+        insert into `test_equal_for_null_tbl`(`pk`,`k1`,`k2`,`v1`) values
+            (0,null,'y',"tell"),
+            (1,null,"his",'b'),
+            (2,null,"we",'g'),
+            (3,null,'n','t'),
+            (4,null,"were",'f'),
+            (5,null,"i",'q'),
+            (6,null,'f','g'),
+            (7,null,"time","are"),
+            (8,null,'k',"you");
+    """
+
+    qt_select " select * from `test_equal_for_null_tbl` where `k1` <=> 4 order 
by 1, 2, 3, 4; "
+}
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to