diff --git a/be/src/common/config.cpp b/be/src/common/config.cpp index cee699e8a9e43b..fd952b28daae63 100644 --- a/be/src/common/config.cpp +++ b/be/src/common/config.cpp @@ -411,7 +411,7 @@ DEFINE_mInt32(data_page_cache_stale_sweep_time_sec, "300"); DEFINE_mInt32(index_page_cache_stale_sweep_time_sec, "600"); DEFINE_mInt32(pk_index_page_cache_stale_sweep_time_sec, "600"); -DEFINE_Bool(enable_low_cardinality_optimize, "true"); +DEFINE_mBool(enable_low_cardinality_optimize, "true"); DEFINE_Bool(enable_low_cardinality_cache_code, "true"); // be policy diff --git a/be/src/common/config.h b/be/src/common/config.h index 6ff07645336595..a7152b8d0d0c48 100644 --- a/be/src/common/config.h +++ b/be/src/common/config.h @@ -459,7 +459,7 @@ DECLARE_mInt32(index_page_cache_stale_sweep_time_sec); // great impact on the performance of MOW, so it can be longer. DECLARE_mInt32(pk_index_page_cache_stale_sweep_time_sec); -DECLARE_Bool(enable_low_cardinality_optimize); +DECLARE_mBool(enable_low_cardinality_optimize); DECLARE_Bool(enable_low_cardinality_cache_code); // be policy diff --git a/be/src/olap/in_list_predicate.h b/be/src/olap/in_list_predicate.h index 4b112ae5ab1028..8d66e437a94ed8 100644 --- a/be/src/olap/in_list_predicate.h +++ b/be/src/olap/in_list_predicate.h @@ -20,6 +20,7 @@ #include #include +#include "common/exception.h" #include "decimal12.h" #include "exprs/hybrid_set.h" #include "olap/column_predicate.h" @@ -527,6 +528,11 @@ class InListPredicateBase : public ColumnPredicate { } else { auto* nested_col_ptr = vectorized::check_and_get_column< vectorized::PredicateColumnType>>(column); + if (nested_col_ptr == nullptr) { + throw Exception(ErrorCode::INTERNAL_ERROR, + "InListPredicateBase: _base_evaluate_bit get invalid column type"); + } + auto& data_array = nested_col_ptr->get_data(); for (uint16_t i = 0; i < size; i++) { diff --git a/be/src/olap/rowset/segment_v2/segment_iterator.cpp b/be/src/olap/rowset/segment_v2/segment_iterator.cpp index facfba00027a80..98c82710524b9b 100644 --- a/be/src/olap/rowset/segment_v2/segment_iterator.cpp +++ b/be/src/olap/rowset/segment_v2/segment_iterator.cpp @@ -1562,9 +1562,10 @@ void SegmentIterator::_vec_init_char_column_id(vectorized::Block* block) { _char_type_idx_no_0.emplace_back(i); } } - if (column_desc->type() == FieldType::OLAP_FIELD_TYPE_CHAR) { - _is_char_type[cid] = true; - } + } + + if (column_desc->type() == FieldType::OLAP_FIELD_TYPE_CHAR) { + _is_char_type[cid] = true; } } } diff --git a/regression-test/data/query_p0/sql_functions/conditional_functions/test_in_no_concurrent.out b/regression-test/data/query_p0/sql_functions/conditional_functions/test_in_no_concurrent.out new file mode 100644 index 00000000000000..a14007ca22a4ed --- /dev/null +++ b/regression-test/data/query_p0/sql_functions/conditional_functions/test_in_no_concurrent.out @@ -0,0 +1,17 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !select -- +5 + +-- !select1 -- +3 + +-- !select2 -- +a +c +i + +-- !select3 -- +a +c +i + diff --git a/regression-test/suites/query_p0/sql_functions/conditional_functions/test_in_no_concurrent.groovy b/regression-test/suites/query_p0/sql_functions/conditional_functions/test_in_no_concurrent.groovy new file mode 100644 index 00000000000000..0bcb7ab8403ef4 --- /dev/null +++ b/regression-test/suites/query_p0/sql_functions/conditional_functions/test_in_no_concurrent.groovy @@ -0,0 +1,67 @@ +// 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_in_no_concurrent", "nonConcurrent") { + + sql "DROP TABLE IF EXISTS `test_in_no_concurrent_tbl`" + sql """ + CREATE TABLE `test_in_no_concurrent_tbl` ( + `id` int NULL, + `c1` char(10) NULL, + `c2` char(20) NULL + ) ENGINE=OLAP + DUPLICATE KEY(`id`, `c1`, `c2`) + DISTRIBUTED BY RANDOM BUCKETS AUTO + PROPERTIES ( + "replication_allocation" = "tag.location.default: 1", + "disable_auto_compaction" = "true" + ); + """ + + sql """ + insert into `test_in_no_concurrent_tbl` values + (1, 'a', 'b'), + (2, 'c', 'd'), + (3, 'e', 'f'), + (4, 'g', 'h'), + (5, 'i', 'j'); + """ + + qt_select """ + select count(*) from `test_in_no_concurrent_tbl`; + """ + + sql """ + delete from `test_in_no_concurrent_tbl` where id > 1 and c2 in ('h', 'f'); + """ + + set_be_param("enable_low_cardinality_optimize", "false"); + + qt_select1 """ + select count(*) from `test_in_no_concurrent_tbl`; + """ + + qt_select2 """ + select c1 from `test_in_no_concurrent_tbl` order by 1; + """ + + set_be_param("enable_low_cardinality_optimize", "true"); + + qt_select3 """ + select c1 from `test_in_no_concurrent_tbl` order by 1; + """ +}