[Fix](inverted index) fix wrong no need read data when same column in inverted index and like function #36687 (#38581)

cherry pick from #36687
This commit is contained in:
airborne12
2024-07-31 19:41:39 +08:00
committed by GitHub
parent a75511ae08
commit 7730aa2170
3 changed files with 14 additions and 0 deletions

View File

@ -365,12 +365,18 @@ Status SegmentIterator::_init_impl(const StorageReadOptions& opts) {
std::set<std::string> push_down_preds;
for (auto* pred : _col_predicates) {
if (!_check_apply_by_inverted_index(pred)) {
//column predicate, like column predicate etc. always need read data
auto cid = pred->column_id();
_need_read_data_indices[cid] = true;
continue;
}
push_down_preds.insert(_gen_predicate_result_sign(pred));
}
for (auto* pred : _col_preds_except_leafnode_of_andnode) {
if (!_check_apply_by_inverted_index(pred)) {
//column predicate, like column predicate etc. always need read data
auto cid = pred->column_id();
_need_read_data_indices[cid] = true;
continue;
}
push_down_preds.insert(_gen_predicate_result_sign(pred));

View File

@ -19,3 +19,9 @@
-- !sql2 --
2024-06-17T15:16:49 tengxun2
-- !sql3 --
1
-- !sql4 --
2024-06-17T15:16:49 tengxun2

View File

@ -110,4 +110,6 @@ suite("test_need_read_data", "p0"){
qt_sql1 """ select COUNT(1) from ${indexTbName2} WHERE a >= '2024-06-15 00:00:00' AND b = 'tengxun2' and `b` match 'tengxun2' ; """
qt_sql2 """ select * from ${indexTbName2} WHERE a >= '2024-06-15 00:00:00' AND b = 'tengxun2' and `b` match 'tengxun2' ; """
qt_sql3 """ select COUNT(1) from ${indexTbName2} WHERE a >= '2024-06-15 00:00:00' AND b like '%tengxun%' and `b` match 'tengxun2' ; """
qt_sql4 """ select * from ${indexTbName2} WHERE a >= '2024-06-15 00:00:00' AND b like '%tengxun%' and `b` match 'tengxun2' ; """
}