This is an automated email from the ASF dual-hosted git repository. yiguolei pushed a commit to branch branch-2.0 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push: new 5b219512197 [fix](function) incorrect result of eq_for_null (#32103) (#32134) 5b219512197 is described below commit 5b2195121972b7cd4769e18d1163545d885868c0 Author: Jerry Hu <mrh...@gmail.com> AuthorDate: Tue Mar 12 21:48:27 2024 +0800 [fix](function) incorrect result of eq_for_null (#32103) (#32134) --- be/src/vec/functions/comparison_equal_for_null.cpp | 2 +- .../data/correctness_p0/test_null_equal.out | 5 +++ .../suites/correctness_p0/test_null_equal.groovy | 52 ++++++++++++++++++++++ 3 files changed, 58 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 84a26f20986..32786310653 100644 --- a/be/src/vec/functions/comparison_equal_for_null.cpp +++ b/be/src/vec/functions/comparison_equal_for_null.cpp @@ -192,7 +192,7 @@ private: } } else { for (int i = 0; i < rows; ++i) { - result[i] &= (left[i] == right[i]); + result[i] = (left[i] == right[i]) & (left[i] | result[i]); } } } diff --git a/regression-test/data/correctness_p0/test_null_equal.out b/regression-test/data/correctness_p0/test_null_equal.out index 2c927e4744b..c8d3254b8ad 100644 --- a/regression-test/data/correctness_p0/test_null_equal.out +++ b/regression-test/data/correctness_p0/test_null_equal.out @@ -197,3 +197,8 @@ false -- !test7 -- 1 +-- !test8 -- +3 the 4 +4 will 0 +8 6 + diff --git a/regression-test/suites/correctness_p0/test_null_equal.groovy b/regression-test/suites/correctness_p0/test_null_equal.groovy index 1f893f9aac3..f515c8fdff3 100644 --- a/regression-test/suites/correctness_p0/test_null_equal.groovy +++ b/regression-test/suites/correctness_p0/test_null_equal.groovy @@ -73,4 +73,56 @@ suite("test_null_equal") { qt_test7 "select * from test_eq_for_null_nullable2 where k1 <=> 1 order by 1;" + sql """ + drop table if exists test_eq_for_null_non_const_table1; + """ + sql """ + drop table if exists test_eq_for_null_non_const_table2; + """ + + sql """ + create table test_eq_for_null_non_const_table1 ( + col_int_undef_signed int, + col_varchar_10__undef_signed varchar(10) , + pk int + ) engine=olap + distributed by hash(pk) buckets 10 + properties("replication_num" = "1"); + """ + + sql """ + insert into test_eq_for_null_non_const_table1(pk,col_int_undef_signed,col_varchar_10__undef_signed) values + (0,4,'will'),(1,null,''),(2,null,'y'),(3,null,''),(4,3,'the'),(5,6,'when'),(6,8,''),(7,6,''),(8,null,null); + """ + + sql """ + create table test_eq_for_null_non_const_table2 ( + col_int_undef_signed int, + col_varchar_10__undef_signed varchar(10), + pk int + ) engine=olap + distributed by hash(pk) buckets 10 + properties("replication_num" = "1"); + """ + + sql """ + insert into test_eq_for_null_non_const_table2(pk,col_int_undef_signed,col_varchar_10__undef_signed) values + (0,null,null),(1,null,'tell'),(2,null,null),(3,null,'is'),(4,null,'oh'),(5,1,'who'),(6,7,''), + (7,1,'I''m'),(8,null,null),(9,0,'how'),(10,null,null),(11,4,'why'),(12,null,'o'),(13,null,'he''s'), + (14,6,''),(15,0,''),(16,7,''),(17,7,'good'),(18,8,''),(19,null,''),(20,6,''); + """ + + qt_test8 """ + SELECT * + FROM test_eq_for_null_non_const_table1 AS t1 + WHERE t1.`pk` NOT IN ( + SELECT + `pk` + FROM test_eq_for_null_non_const_table2 AS t2 + WHERE + ( t1. col_int_undef_signed > t2 . col_int_undef_signed + 1 ) + OR t1. col_int_undef_signed + 3 <=> t2 . col_int_undef_signed + ) + ORDER BY 1, 2, 3; + """ } \ No newline at end of file --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org