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 98f4301f15c branch-3.1: [fix](inverted index) Fix skipping data reads
for columns when index is hit #57461 (#57475)
98f4301f15c is described below
commit 98f4301f15cb25812fee55430038c0bfa7bfaf81
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Mon Nov 3 11:27:34 2025 +0800
branch-3.1: [fix](inverted index) Fix skipping data reads for columns when
index is hit #57461 (#57475)
Cherry-picked from #57461
Co-authored-by: Sun Chenyang <[email protected]>
---
be/src/olap/rowset/segment_v2/segment_iterator.cpp | 7 ++++++-
.../data/variant_p0/predefine/test_predefine_type_index.out | 6 ++++++
.../suites/variant_p0/predefine/test_predefine_type_index.groovy | 4 +++-
3 files changed, 15 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 81c6affc5b4..ca17c61415f 100644
--- a/be/src/olap/rowset/segment_v2/segment_iterator.cpp
+++ b/be/src/olap/rowset/segment_v2/segment_iterator.cpp
@@ -948,7 +948,12 @@ bool SegmentIterator::_need_read_data(ColumnId cid) {
// and the operation is a push down of the 'COUNT_ON_INDEX' aggregation
function.
// If any of the above conditions are met, log a debug message indicating
that there's no need to read data for the indexed column.
// Then, return false.
- int32_t unique_id = _opts.tablet_schema->column(cid).unique_id();
+ const auto& column = _opts.tablet_schema->column(cid);
+ // Different subcolumns may share the same parent_unique_id, so we choose
to abandon this optimization.
+ if (column.is_extracted_column()) {
+ return true;
+ }
+ int32_t unique_id = column.unique_id();
if ((_need_read_data_indices.contains(cid) &&
!_need_read_data_indices[cid] &&
!_output_columns.contains(unique_id)) ||
(_need_read_data_indices.contains(cid) &&
!_need_read_data_indices[cid] &&
diff --git
a/regression-test/data/variant_p0/predefine/test_predefine_type_index.out
b/regression-test/data/variant_p0/predefine/test_predefine_type_index.out
index cffe89f0a28..13b2162cd1b 100644
--- a/regression-test/data/variant_p0/predefine/test_predefine_type_index.out
+++ b/regression-test/data/variant_p0/predefine/test_predefine_type_index.out
@@ -71,3 +71,9 @@
-- !sql --
20
+-- !sql --
+Bright Red
+
+-- !sql --
+Bright Red
+
diff --git
a/regression-test/suites/variant_p0/predefine/test_predefine_type_index.groovy
b/regression-test/suites/variant_p0/predefine/test_predefine_type_index.groovy
index 67944ba1d27..3f1f0dd6e68 100644
---
a/regression-test/suites/variant_p0/predefine/test_predefine_type_index.groovy
+++
b/regression-test/suites/variant_p0/predefine/test_predefine_type_index.groovy
@@ -107,5 +107,7 @@ suite("test_variant_predefine_index_type", "p0"){
trigger_and_wait_compaction(tableName, "cumulative")
sql "set enable_match_without_inverted_index = false"
qt_sql "select count() from objects where (overflow_properties['color']
MATCH_PHRASE 'Blue')"
- qt_sql "select count() from objects where
(array_contains(cast(overflow_properties['tags'] as array<string>),
'plastic'))"
+ qt_sql "select count() from objects where
(array_contains(cast(overflow_properties['tags'] as array<string>),
'plastic'))"
+ qt_sql "select cast(overflow_properties['color'] as string) from objects
where overflow_properties['color'] IS NOT NULL and id = 6 limit 1"
+ qt_sql "select overflow_properties['color'] from objects where
overflow_properties['color'] IS NOT NULL and id = 6 limit 1"
}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]