You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2024/04/12 15:12:02 UTC

(doris) 03/24: [bug](not in) if not in (null) could eos early (#33482)

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

yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git

commit 7678c0e35484aa745dd5b595c5f942e101a8a0df
Author: zhangstar333 <87...@users.noreply.github.com>
AuthorDate: Thu Apr 11 22:45:29 2024 +0800

    [bug](not in) if not in (null) could eos early (#33482)
    
    * [bug](not in) if not in (null) could eos early
---
 be/src/vec/exec/scan/vscan_node.cpp                |  3 +-
 .../conditional_functions/test_query_in.out        |  2 +
 .../conditional_functions/test_query_in.groovy     | 46 ++++++++++++++++++++++
 3 files changed, 50 insertions(+), 1 deletion(-)

diff --git a/be/src/vec/exec/scan/vscan_node.cpp b/be/src/vec/exec/scan/vscan_node.cpp
index 05a5fe43c25..68895b47739 100644
--- a/be/src/vec/exec/scan/vscan_node.cpp
+++ b/be/src/vec/exec/scan/vscan_node.cpp
@@ -863,7 +863,8 @@ Status VScanNode::_normalize_not_in_and_not_eq_predicate(VExpr* expr, VExprConte
 
         HybridSetBase::IteratorBase* iter = state->hybrid_set->begin();
         auto fn_name = std::string("");
-        if (!is_fixed_range && state->hybrid_set->contain_null()) {
+        // https://github.com/apache/doris/pull/15466
+        if (state->hybrid_set->contain_null()) {
             _eos = true;
         }
         while (iter->has_next()) {
diff --git a/regression-test/data/nereids_p0/sql_functions/conditional_functions/test_query_in.out b/regression-test/data/nereids_p0/sql_functions/conditional_functions/test_query_in.out
index 57ae1887c08..7783afd8631 100644
--- a/regression-test/data/nereids_p0/sql_functions/conditional_functions/test_query_in.out
+++ b/regression-test/data/nereids_p0/sql_functions/conditional_functions/test_query_in.out
@@ -104,3 +104,5 @@ jj	-28532
 false	1	1989	1001	11011902	123.123	true	1989-03-21	1989-03-21T13:00	wangjuoo4	0.1	6.333	string12345	170141183460469231731687303715884105727
 false	3	1989	1002	11011905	24453.325	false	2012-03-14	2000-01-01T00:00	yunlj8@nk	78945.0	3654.0	string12345	0
 
+-- !in33 --
+
diff --git a/regression-test/suites/nereids_p0/sql_functions/conditional_functions/test_query_in.groovy b/regression-test/suites/nereids_p0/sql_functions/conditional_functions/test_query_in.groovy
index d65e969b42b..1de3321f0fd 100644
--- a/regression-test/suites/nereids_p0/sql_functions/conditional_functions/test_query_in.groovy
+++ b/regression-test/suites/nereids_p0/sql_functions/conditional_functions/test_query_in.groovy
@@ -64,4 +64,50 @@ suite("test_query_in", "query,p0") {
     qt_in31 """select * from (select 'jj' as kk1, sum(k2) from ${tableName2} where k10 = '2015-04-02' group by kk1)tt
             where kk1 = 'jj'"""
     qt_in32 """select * from ${tableName1} where cast(k1 as char) in (1, -1, 5, 0.1, 3.000) order by k1, k2, k3, k4"""
+
+    sql """DROP TABLE IF EXISTS                             table_200_undef_partitions2_keys3_properties4_distributed_by56""" 
+    sql """
+        CREATE TABLE `table_200_undef_partitions2_keys3_properties4_distributed_by56` (
+        `col_int_undef_signed_not_null` int(11) NOT NULL,
+        `col_date_undef_signed_not_null` date NOT NULL,
+        `col_bigint_undef_signed_not_null` bigint(20) NOT NULL,
+        `col_int_undef_signed` int(11) NULL,
+        `col_bigint_undef_signed` bigint(20) NULL,
+        `col_date_undef_signed` date NULL,
+        `col_varchar_10__undef_signed` varchar(10) NULL,
+        `col_varchar_10__undef_signed_not_null` varchar(10) NOT NULL,
+        `col_varchar_1024__undef_signed` varchar(1024) NULL,
+        `col_varchar_1024__undef_signed_not_null` varchar(1024) NOT NULL,
+        `pk` int(11) NULL
+        ) ENGINE=OLAP
+        duplicate KEY(`col_int_undef_signed_not_null`, `col_date_undef_signed_not_null`, `col_bigint_undef_signed_not_null`)
+        COMMENT 'OLAP'
+        PARTITION BY RANGE(`col_int_undef_signed_not_null`, `col_date_undef_signed_not_null`)
+        (PARTITION p VALUES [("-2147483648", '0000-01-01'), ("-1", '1997-12-11')),
+        PARTITION p0 VALUES [("-1", '1997-12-11'), ("4", '2023-12-11')),
+        PARTITION p1 VALUES [("4", '2023-12-11'), ("6", '2023-12-15')),
+        PARTITION p2 VALUES [("6", '2023-12-15'), ("7", '2023-12-16')),
+        PARTITION p3 VALUES [("7", '2023-12-16'), ("8", '2023-12-25')),
+        PARTITION p4 VALUES [("8", '2023-12-25'), ("8", '2024-01-18')),
+        PARTITION p5 VALUES [("8", '2024-01-18'), ("10", '2024-02-18')),
+        PARTITION p6 VALUES [("10", '2024-02-18'), ("1147483647", '2056-12-31')),
+        PARTITION p100 VALUES [("1147483647", '2056-12-31'), ("2147483647", '9999-12-31')))
+        DISTRIBUTED BY HASH(`col_bigint_undef_signed_not_null`) BUCKETS 30
+        PROPERTIES (
+        "replication_allocation" = "tag.location.default: 1"
+        );
+    """
+    sql """
+        insert into table_200_undef_partitions2_keys3_properties4_distributed_by56(pk,col_int_undef_signed,col_int_undef_signed_not_null,col_bigint_undef_signed,col_bigint_undef_signed_not_null,col_date_undef_signed,col_date_undef_signed_not_null,col_varchar_10__undef_signed,col_varchar_10__undef_signed_not_null,col_varchar_1024__undef_signed,col_varchar_1024__undef_signed_not_null) values (0,-10,-10,null,858959258950266384,'2024-02-18','2027-01-09',null,'a','b','j'),(1,-10,7,null,674235 [...]
+    """
+
+    qt_in33 """
+        SELECT
+        col_varchar_1024__undef_signed
+        FROM
+        table_200_undef_partitions2_keys3_properties4_distributed_by56 AS table1
+        WHERE
+        table1.`col_varchar_1024__undef_signed` NOT IN (NULL, 'c')
+        AND table1.`col_varchar_1024__undef_signed` IN (NULL, 'u', 'd');
+    """
 }


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