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

eldenmoon 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 47b9b34327 [bugfix](topn) fix miss-use of unique_id causing vector 
buffer overflow (#23829)
47b9b34327 is described below

commit 47b9b34327e7d8e123a5072d15998b3eac88c741
Author: Kang <kxiao.ti...@gmail.com>
AuthorDate: Mon Sep 4 15:02:26 2023 +0800

    [bugfix](topn) fix miss-use of unique_id causing vector buffer overflow 
(#23829)
    
    miss-use: the original cid is actually unique_id and 
_schema->unique_id(cid) is wrong.
    
    BTW, there is no problem in master branch, since it's refactored by #23505.
---
 be/src/olap/rowset/segment_v2/segment_iterator.cpp          | 5 +++--
 regression-test/suites/datatype_p0/scalar_types/load.groovy | 3 +++
 regression-test/suites/datatype_p2/scalar_types/load.groovy | 3 +++
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/be/src/olap/rowset/segment_v2/segment_iterator.cpp 
b/be/src/olap/rowset/segment_v2/segment_iterator.cpp
index 8792c5474f..4c54ade3d1 100644
--- a/be/src/olap/rowset/segment_v2/segment_iterator.cpp
+++ b/be/src/olap/rowset/segment_v2/segment_iterator.cpp
@@ -472,13 +472,14 @@ Status 
SegmentIterator::_get_row_ranges_from_conditions(RowRanges* condition_row
         auto query_ctx = _opts.runtime_state->get_query_ctx();
         runtime_predicate = 
query_ctx->get_runtime_predicate().get_predictate();
         if (runtime_predicate) {
-            int32_t cid = 
_opts.tablet_schema->column(runtime_predicate->column_id()).unique_id();
+            int32_t unique_id =
+                    
_opts.tablet_schema->column(runtime_predicate->column_id()).unique_id();
             AndBlockColumnPredicate and_predicate;
             auto single_predicate = new 
SingleColumnBlockPredicate(runtime_predicate.get());
             and_predicate.add_column_predicate(single_predicate);
 
             RowRanges column_rp_row_ranges = 
RowRanges::create_single(num_rows());
-            
RETURN_IF_ERROR(_column_iterators[_schema->unique_id(cid)]->get_row_ranges_by_zone_map(
+            
RETURN_IF_ERROR(_column_iterators[unique_id]->get_row_ranges_by_zone_map(
                     &and_predicate, nullptr, &column_rp_row_ranges));
 
             // intersect different columns's row ranges to get final row 
ranges by zone map
diff --git a/regression-test/suites/datatype_p0/scalar_types/load.groovy 
b/regression-test/suites/datatype_p0/scalar_types/load.groovy
index 7577bbb819..054958bf5b 100644
--- a/regression-test/suites/datatype_p0/scalar_types/load.groovy
+++ b/regression-test/suites/datatype_p0/scalar_types/load.groovy
@@ -51,6 +51,9 @@ suite("test_scalar_types_load", "p0") {
         PROPERTIES("replication_num" = "1", "store_row_column" = "true");
         """
 
+    sql """ ALTER TABLE ${testTable} DROP COLUMN c_bigint """
+    sql """ ALTER TABLE ${testTable}  ADD COLUMN c_bigint bigint AFTER c_int 
"""
+
     // load data
     streamLoad {
         table testTable
diff --git a/regression-test/suites/datatype_p2/scalar_types/load.groovy 
b/regression-test/suites/datatype_p2/scalar_types/load.groovy
index c68882e249..8147c08a31 100644
--- a/regression-test/suites/datatype_p2/scalar_types/load.groovy
+++ b/regression-test/suites/datatype_p2/scalar_types/load.groovy
@@ -51,6 +51,9 @@ suite("test_scalar_types_load_p2", "p2") {
         PROPERTIES("replication_num" = "1");
         """
 
+    sql """ ALTER TABLE ${testTable} DROP COLUMN c_bigint """
+    sql """ ALTER TABLE ${testTable}  ADD COLUMN c_bigint bigint AFTER c_int 
"""
+
     // load data
     streamLoad {
         table testTable


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

Reply via email to