From f7789f4bc4ebf5d76949ebc2025f24fc5bc9cc40 Mon Sep 17 00:00:00 2001 From: wangbo Date: Fri, 17 Jun 2022 18:34:25 +0800 Subject: [PATCH] [fix]InListPredicate wrong result (#10211) * fix * reg test Co-authored-by: Wang Bo --- be/src/olap/in_list_predicate.h | 2 +- .../storage/test_dup_tab_basic_int.groovy | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/be/src/olap/in_list_predicate.h b/be/src/olap/in_list_predicate.h index f41a7f51c51ec5..de47a655c3255b 100644 --- a/be/src/olap/in_list_predicate.h +++ b/be/src/olap/in_list_predicate.h @@ -338,7 +338,7 @@ class InListPredicateBase : public ColumnPredicate { } } - if constexpr (is_opposite != (PT == PredicateType::IN_LIST)) { + if constexpr (!is_opposite) { if (_operator(_values.find(reinterpret_cast(data_array[idx])), _values.end())) { sel[new_size++] = idx; diff --git a/regression-test/suites/data_model/duplicate/storage/test_dup_tab_basic_int.groovy b/regression-test/suites/data_model/duplicate/storage/test_dup_tab_basic_int.groovy index ac8ea799bba34a..94430e575cb274 100644 --- a/regression-test/suites/data_model/duplicate/storage/test_dup_tab_basic_int.groovy +++ b/regression-test/suites/data_model/duplicate/storage/test_dup_tab_basic_int.groovy @@ -152,5 +152,21 @@ PROPERTIES ( result([[1,2,3,4]]) } + // predicate in with two values + test { + sql """ + select distinct userid as col from ${table1} where userid in (3,7) order by col; + """ + result([[3],[7]]) + } + + // predicate not with two values + test { + sql """ + select distinct userid as col from ${table1} where userid not in (3,7) order by col; + """ + result([[11],[15],[19],[22]]) + } + sql "drop table if exists ${table1}" }