This is an automated email from the ASF dual-hosted git repository.
kxiao 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 e126784d540 [fix](topn opt) avoid using topn runtime predicate which
segment does not contain such column(column unique id) when pruning segment
#29148 (#29152)
e126784d540 is described below
commit e126784d540b2f6090bd560826e9d6347dcfcb4e
Author: lihangyu <[email protected]>
AuthorDate: Thu Dec 28 10:25:39 2023 +0800
[fix](topn opt) avoid using topn runtime predicate which segment does not
contain such column(column unique id) when pruning segment #29148 (#29152)
---
be/src/olap/rowset/segment_v2/segment.cpp | 3 ++-
.../scalar_types/test_key_topn_merge_block_columns.groovy | 5 +++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/be/src/olap/rowset/segment_v2/segment.cpp
b/be/src/olap/rowset/segment_v2/segment.cpp
index 791c666d307..483a8e81949 100644
--- a/be/src/olap/rowset/segment_v2/segment.cpp
+++ b/be/src/olap/rowset/segment_v2/segment.cpp
@@ -156,7 +156,8 @@ Status Segment::new_iterator(SchemaSPtr schema, const
StorageReadOptions& read_o
AndBlockColumnPredicate and_predicate;
auto single_predicate = new
SingleColumnBlockPredicate(runtime_predicate.get());
and_predicate.add_column_predicate(single_predicate);
- if (!_column_readers.at(uid)->match_condition(&and_predicate)) {
+ if (_column_readers.count(uid) >= 1 &&
+ !_column_readers.at(uid)->match_condition(&and_predicate)) {
// any condition not satisfied, return.
iter->reset(new EmptySegmentIterator(*schema));
read_options.stats->filtered_segment_number++;
diff --git
a/regression-test/suites/datatype_p0/scalar_types/test_key_topn_merge_block_columns.groovy
b/regression-test/suites/datatype_p0/scalar_types/test_key_topn_merge_block_columns.groovy
index 92af65e09ac..b917bd4214f 100644
---
a/regression-test/suites/datatype_p0/scalar_types/test_key_topn_merge_block_columns.groovy
+++
b/regression-test/suites/datatype_p0/scalar_types/test_key_topn_merge_block_columns.groovy
@@ -73,4 +73,9 @@ suite("test_key_topn_merge_block_columns", "p0") {
// will cause be core if bug not fix by #20820
sql "SELECT /*+ SET_VAR(topn_opt_limit_threshold=1024) */ * FROM
${testTable} WHERE c_int = 100 or k1 = 1000 ORDER BY k1 LIMIT 10"
+ sql "insert into ${testTable} select * from ${testTable}"
+ sql "insert into ${testTable} select * from ${testTable}"
+ sql "insert into ${testTable} select * from ${testTable}"
+ sql """ alter table ${testTable} ADD COLUMN (new_k1 INT DEFAULT '1',
new_k2 INT DEFAULT '2');"""
+ sql "select * from ${testTable} order by new_k1 limit 1"
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]