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

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


The following commit(s) were added to refs/heads/branch-3.1 by this push:
     new 24ee66ec758 branch-3.1: [fix](olap) A crash caused by an incorrect 
storage type in the IN predicate #56309 (#56834)
24ee66ec758 is described below

commit 24ee66ec7589b1f6415a58bac55ee6b79025b029
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Mon Oct 13 12:11:18 2025 +0800

    branch-3.1: [fix](olap) A crash caused by an incorrect storage type in the 
IN predicate #56309 (#56834)
    
    Cherry-picked from #56309
    
    Co-authored-by: Jerry Hu <[email protected]>
---
 be/src/common/config.cpp                           |  2 +-
 be/src/common/config.h                             |  2 +-
 be/src/olap/in_list_predicate.h                    |  6 ++
 be/src/olap/rowset/segment_v2/segment_iterator.cpp |  7 ++-
 .../test_in_no_concurrent.out                      | 17 ++++++
 .../test_in_no_concurrent.groovy                   | 67 ++++++++++++++++++++++
 6 files changed, 96 insertions(+), 5 deletions(-)

diff --git a/be/src/common/config.cpp b/be/src/common/config.cpp
index cee699e8a9e..fd952b28daa 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 6ff07645336..a7152b8d0d0 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 4b112ae5ab1..8d66e437a94 100644
--- a/be/src/olap/in_list_predicate.h
+++ b/be/src/olap/in_list_predicate.h
@@ -20,6 +20,7 @@
 #include <cstdint>
 #include <roaring/roaring.hh>
 
+#include "common/exception.h"
 #include "decimal12.h"
 #include "exprs/hybrid_set.h"
 #include "olap/column_predicate.h"
@@ -527,6 +528,11 @@ private:
         } else {
             auto* nested_col_ptr = vectorized::check_and_get_column<
                     
vectorized::PredicateColumnType<PredicateEvaluateType<Type>>>(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 b44fc04edea..81c6affc5b4 100644
--- a/be/src/olap/rowset/segment_v2/segment_iterator.cpp
+++ b/be/src/olap/rowset/segment_v2/segment_iterator.cpp
@@ -1569,9 +1569,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 00000000000..a14007ca22a
--- /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 00000000000..0bcb7ab8403
--- /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;
+    """
+}


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

Reply via email to