Skip to content

Commit 78454d9

Browse files
morningmansollhuizhiqiang-hhhhclaudemymeiyi
authored
branch-4.0: [fix](test) fix branch-4.0 P0 regression failures (build #198126) (#64525)
## What problem does this PR solve? Stabilizes the `branch-4.0` P0 / Cloud-P0 regression pipeline. It started from the failures in regression build #198126 and has since grown to cover additional flaky / failing suites surfaced by subsequent P0 and Cloud-P0 runs. Most commits are test-only (deflaking, isolation, session-default pinning, branch-4.0 compatibility, or temporarily skipping cases whose feature is absent / whose backport is pending). Two are real product fixes backported from master, plus one debug-point gate change with no production impact. ### Product fixes backported from master - **#64439** `[fix](load) fix empty statistics for forwarded INSERT` — a forwarded `INSERT ... SELECT` showed empty `JobDetails` (`ScannedRows=0`, `LoadBytes=0`, …) because the regular `Coordinator` / `CloudCoordinator` fallback path was built without the insert `jobId`, so `LoadManager` progress was never initialized/updated. The `jobId` is now preserved on both fallback paths. Fixes `load_p0/insert/test_insert_statistic`. - **#63666** `[fix](ann-index) Fix ANN range search state leakage and incorrect slot index tracking` — ANN range-search execution state was stored on the shared `VExpr` root, so a segment that ran ANN range search could leak state into a segment without an ANN index and wrongly drop the common expression; it also mixed schema column indexes with storage column ids. State now flows through the evaluation call and slot status is keyed by source column index. Adapted to 4.0 (this branch predates `enable_result_cache`, so that parameter is dropped from the ported signatures). ### Product change behind a debug point (no production impact) - `[fix](compaction) let time_series_level2_file_count debug point bypass the level2 freshness gate` — the 24h freshness gate skipped freshly-created level1 rowsets before the `time_series_level2_file_count` debug point could collect them, so `test_time_series_compaction_level2` never forced a level-2 merge (tablet kept 11 rowsets instead of 2). The debug point now guards the gate; with debug points disabled `is_enable()` returns false, so behavior is unchanged. ### Test suites backported from master - **#63859** `[test](regression) Add debug point ANN index-only scan test` — replaces the fragile `ScanBytes`-profile-based ANN suites (an unreliable index-only proxy) with debug-point suites that directly fail if the embedding column is read in index-only scenarios. Fixes `ann_index_p0/ann_index_only_scan_distance_expr` and `ann_index_p0/ann_index_only_scan_metric_direction`. - **partial #64238** — ports only the `scanner_profile` `actualRows` regex fix (`PhysicalOlapScan[<id>]` renders the numeric nereids id, not the table name, so the old `PhysicalOlapScan[scanner_profile]` regex could never match). The BE CPU-time counter rename in #64238 is intentionally NOT backported to a release branch. ### Aligned with the `enable_insert_strict` / `enable_strict_cast` decoupling (#63794) - `insert_p0/insert_group_commit_into_max_filter_ratio` — cherry-pick from master. - `external_table_p0/hive/write/test_hive_ctas_to_doris` — set `enable_strict_cast=true` so the CTAS casts behave as the expected output was generated under. ### Deflaking — asynchronous profile-report races The BE reports the detailed execution profile to FE *after* the query result returns; tests that fetched the profile with a fixed sleep raced that report (empty `MergedProfile`). - `query_profile/scanner_profile` — poll `getProfileByToken` (Awaitility) until the scan operator lands before asserting `MaxScanConcurrency` / backfilled `actualRows` (sits on top of the regex fix above; it was the only `query_profile` test with no wait/retry). - `query_profile/adaptive_pipeline_task_serial_read_on_limit` — same fix: poll until `MaxScanConcurrency` lands instead of `Thread.sleep(500)`. - `AutoProfileTest` (FE UT) — the JMockit `result=System.currentTimeMillis()` froze the begin-time at record time while the duration was measured against the real wall clock, leaving only ~101ms of slack. Drop JMockit + both sleeps and set `queryBeginTime` directly (now / now-60s) for a deterministic ~60s margin. ### Deflaking — CBO / statistics timing - `nereids_rules_p0/mv/.../partition_curd_union_rewrite` — guard the six post-insert `mv_rewrite_success` checks with `is_partition_statistics_ready` (matching the suite's own pre-mutation calls); new-partition row-count stats are reported asynchronously, so within the fixed sleep CBO costed the union plan above the direct plan and emitted "not chose". - `nereids_syntax_p0/distribute/prune_bucket_with_bucket_shuffle_join` — pin `parallel_pipeline_task_num=1` so the bucket-shuffle downgrade heuristic (`totalBucketNum < backEndNum*paraNum*0.8`) doesn't fire on a high-core Cloud-P0 agent and downgrade `BUCKET_SHUFFLE` → `PARTITIONED`. - `correctness_p0/test_colocate_join_of_column_order` — inject column stats (`set stats`) before EXPLAIN so the COLOCATE-vs-PARTITIONED cost choice is deterministic (freshly-created tables have `rowCountReported=false` until the async `CloudTabletStatMgr` tick). ### Deflaking — cross-FE system-table semantics - `query_p0/schema_table/test_sql_block_rule_status` — `BLOCKS` is a cross-FE `SUM` over each FE's non-replicated in-memory counter, so a stray counter on another FE makes the sum exceed 1. Set `fetch_all_fe_for_system_table=false` so the read sees only the local FE that ran the blocked query. - `nereids_p0/cache/parse_sql_from_sql_cache` — drop the racy cross-FE `assertNoCache`: the sql-cache result lives on a shared BE chosen by a deterministic hash, so a second FE can legitimately serve the same query from cache. Keep the meaningful `assertHasCache`. ### Deflaking — routine-load adaptive timeout (`test_routine_load_adaptive_param` + `RoutineLoadTestUtils`) The adaptive timeout is only recomputed when a task is scheduled *with* data, and the converged value can sit on an idle (`txnId == -1`) task; the old `txnId != -1` gate raced a sub-second live-txn window. - `RoutineLoadTestUtils.checkTaskTimeout` — skip transient `txnId == -1` tasks and poll until a stable task carries the expected timeout. - restore phase — `checkTaskTimeoutWithData` feeds a small batch each round to force the timeout to recompute. - increase phase — drive data each round too, and rewrite the txn-timeout check to join on the task UUID and read the persisted timeout from the committed transaction (`SHOW TRANSACTION WHERE label`) instead of catching a live txn. ### Deflaking — publish / delete visibility & file cache - `fault_injection_p0/.../test_f_delete_publish_skip_read` — replace `Thread.sleep(12000)` with a bounded Awaitility poll until the delete (v4) is actually published and visible (`k1=2` gone). The storage engine applies the delete correctly; the race was in publish timing (the `disable_block` request could queue behind the in-flight stream load). - `external_table_p0/cache/test_file_cache_statistics` (and `test_file_cache_query_limit`) — `file_cache_statistics` reports one row per `(cache_path, metric)` and a data file hashes to exactly one path, so a bare `limit 1` inspected an arbitrary path. Sum each metric across paths (`SUM(CAST(METRIC_VALUE AS DOUBLE))`) and replace fixed sleeps with Awaitility. ### Determinism — pin fuzzed session defaults / fix drifted expected output - `check_before_quit` — pin the two fuzzed variant session defaults to 0 so the CREATE → recreate → show-create round-trip is idempotent for property-less variant columns. - `variant_p0/.../test_variant_compaction_with_sparse_limit` — pin `default_variant_max_subcolumns_count=2048` (the FE default the `.out` was generated under) so nested paths stay typed subcolumns. - `audit/test_audit_log_behavior` — correct the drifted `query_id` column to `varchar(128)` (`Config.label_regex_length`); `stmt_type` stays `varchar(48)`. ### branch-4.0 compatibility — remove unsupported `enable_condition_cache` variable `enable_condition_cache` does not exist on branch-4.0, so `set enable_condition_cache=false` fails with "Unknown system variable". Removing the line is a semantic no-op (the branch is already in the cache-disabled state the tests expect). Applied to the `ann_index_only_scan` debug-point cases (from #63859) and the `ann_range_search` cases (from #63666). ### Test isolation - `backup_restore/test_backup_restore_reset_index_id` (+ `test_backup_restore_inverted_idx`, `restore_p0/test_validate_restore_inverted_idx`) — these three suites mutate the process-global `restore_reset_index_id` FE config; running in parallel, one could flip it between another suite's BACKUP and RESTORE (build #198126). They are now in the `nonConcurrent` group so they run serially. The FE reset logic itself is correct; purely a test-isolation fix. ### Temporarily skipped / disabled - `temp_table_p0/test_temp_table` — **skipped** (the temp-table feature is no longer maintained). An earlier commit had hardened its replica-count detection for build #198126, but the suite is now skipped outright. - `ann_index_p0/ann_range_search_pushdown_regression` — disabled pending backport of **#64082**: it builds an under-sized IVF scan that relies on the BE skipping ANN index build for segments smaller than `nlist`; without #64082 the single-row INSERT fails at segment finalize with faiss `nx >= k`. Re-enable after picking #64082. - `external_table_p0/hive/test_parquet_join_runtime_filter` — skipped (feature not supported on 4.0). - `shape_check/tpcds_sf100/shape/query64` and `shape_check/tpcds_sf1000/shape/query64` — ignored (unstable shape checks). ## Release note None ## Check List (For Committer) - [x] Test <!-- regression tests --> ## Check List (For Reviewer who provide ASF feature) - [ ] Performance regression --------- Co-authored-by: hui lai <laihui@selectdb.com> Co-authored-by: zhiqiang <seuhezhiqiang@163.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: meiyi <meiyi@selectdb.com>
1 parent bc17fb7 commit 78454d9

49 files changed

Lines changed: 1449 additions & 1175 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

be/src/olap/cumulative_compaction_time_series_policy.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "common/logging.h"
2525
#include "olap/tablet.h"
2626
#include "olap/tablet_meta.h"
27+
#include "util/debug_points.h"
2728
#include "util/time.h"
2829

2930
namespace doris {
@@ -378,8 +379,14 @@ int32_t TimeSeriesCumulativeCompactionPolicy::pick_input_rowsets(
378379
if (rs_meta->compaction_level() == 0) {
379380
break;
380381
}
382+
// The debug point time_series_level2_file_count lets a test force a level-2
383+
// merge by file count regardless of rowset age. Without bypassing this 24h
384+
// freshness gate, freshly-created level1 rowsets are all skipped and the debug
385+
// point below can never collect them. No effect in production: the debug point
386+
// is disabled there, so the added condition is always true.
381387
if (rs_meta->compaction_level() == 1 &&
382-
(now - rs_meta->creation_time()) <= MAX_LEVEL2_COMPACTION_TIMEOUT) {
388+
(now - rs_meta->creation_time()) <= MAX_LEVEL2_COMPACTION_TIMEOUT &&
389+
!DebugPoints::instance()->is_enable("time_series_level2_file_count")) {
383390
continue;
384391
}
385392
level1_rowsets.push_back(rowset);

be/src/olap/rowset/segment_v2/segment_iterator.cpp

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,9 +1110,14 @@ Status SegmentIterator::_apply_index_expr() {
11101110
segment_v2::AnnIndexStats ann_index_stats;
11111111
for (const auto& expr_ctx : _common_expr_ctxs_push_down) {
11121112
size_t origin_rows = _row_bitmap.cardinality();
1113+
bool ann_range_search_executed = false;
11131114
RETURN_IF_ERROR(expr_ctx->evaluate_ann_range_search(
11141115
_index_iterators, _schema->column_ids(), _column_iterators,
1115-
_common_expr_to_slotref_map, _row_bitmap, ann_index_stats));
1116+
_common_expr_to_slotref_map, _row_bitmap, ann_index_stats,
1117+
&ann_range_search_executed));
1118+
if (ann_range_search_executed) {
1119+
_opts.stats->ann_index_range_search_cnt++;
1120+
}
11161121
_opts.stats->rows_ann_index_range_filtered += (origin_rows - _row_bitmap.cardinality());
11171122
_opts.stats->ann_index_load_ns += ann_index_stats.load_index_costs_ns.value();
11181123
_opts.stats->ann_index_range_search_ns += ann_index_stats.search_costs_ns.value();
@@ -1122,16 +1127,6 @@ Status SegmentIterator::_apply_index_expr() {
11221127
_opts.stats->ann_range_pre_process_ns += ann_index_stats.engine_prepare_ns.value();
11231128
}
11241129

1125-
for (auto it = _common_expr_ctxs_push_down.begin(); it != _common_expr_ctxs_push_down.end();) {
1126-
if ((*it)->root()->ann_range_search_executedd()) {
1127-
_opts.stats->ann_index_range_search_cnt++;
1128-
it = _common_expr_ctxs_push_down.erase(it);
1129-
} else {
1130-
++it;
1131-
}
1132-
}
1133-
// TODO:Do we need to remove these expr root from _remaining_conjunct_roots?
1134-
11351130
return Status::OK();
11361131
}
11371132

be/src/vec/exprs/vectorized_fn_call.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,9 @@ Status VectorizedFnCall::evaluate_ann_range_search(
534534
const std::vector<std::unique_ptr<segment_v2::IndexIterator>>& cid_to_index_iterators,
535535
const std::vector<ColumnId>& idx_to_cid,
536536
const std::vector<std::unique_ptr<segment_v2::ColumnIterator>>& column_iterators,
537-
roaring::Roaring& row_bitmap, segment_v2::AnnIndexStats& ann_index_stats) {
537+
roaring::Roaring& row_bitmap, segment_v2::AnnIndexStats& ann_index_stats,
538+
AnnRangeSearchEvaluationResult& evaluation_result) {
539+
evaluation_result = {};
538540
if (range_search_runtime.is_ann_range_search == false) {
539541
return Status::OK();
540542
}
@@ -543,8 +545,8 @@ Status VectorizedFnCall::evaluate_ann_range_search(
543545
range_search_runtime.to_string());
544546
size_t origin_num = row_bitmap.cardinality();
545547

546-
int idx_in_block = static_cast<int>(range_search_runtime.src_col_idx);
547-
DCHECK(idx_in_block < idx_to_cid.size())
548+
const auto idx_in_block = range_search_runtime.src_col_idx;
549+
DCHECK_LT(idx_in_block, idx_to_cid.size())
548550
<< "idx_in_block: " << idx_in_block << ", idx_to_cid.size(): " << idx_to_cid.size();
549551

550552
ColumnId src_col_cid = idx_to_cid[idx_in_block];
@@ -611,6 +613,7 @@ Status VectorizedFnCall::evaluate_ann_range_search(
611613
row_bitmap = *result.roaring;
612614

613615
// Process virtual column
616+
bool dist_fulfilled = false;
614617
if (range_search_runtime.dst_col_idx >= 0) {
615618
// Prepare materialization if we can use result from index.
616619
// Typical situation: range search and operator is LE or LT.
@@ -634,7 +637,7 @@ Status VectorizedFnCall::evaluate_ann_range_search(
634637
}
635638
virtual_column_iterator->prepare_materialization(std::move(distance_col),
636639
std::move(result.row_ids));
637-
_virtual_column_is_fulfilled = true;
640+
dist_fulfilled = true;
638641
} else {
639642
// Whether the ANN index should have produced distance depends on metric and operator:
640643
// - L2: distance is produced for LE/LT; not produced for GE/GT
@@ -648,17 +651,17 @@ Status VectorizedFnCall::evaluate_ann_range_search(
648651
// If we expected distance but didn't get it, assert in debug to catch logic errors.
649652
DCHECK(!should_have_distance) << "Expected distance from ANN index but got none";
650653
#endif
651-
_virtual_column_is_fulfilled = false;
652654
}
653655
} else {
654656
// Dest is not virtual column.
655-
_virtual_column_is_fulfilled = true;
657+
dist_fulfilled = true;
656658
}
657659

658-
_has_been_executed = true;
660+
evaluation_result.executed = true;
661+
evaluation_result.dist_fulfilled = dist_fulfilled;
659662
VLOG_DEBUG << fmt::format(
660663
"Ann range search filtered {} rows, origin {} rows, virtual column is full-filled: {}",
661-
origin_num - row_bitmap.cardinality(), origin_num, _virtual_column_is_fulfilled);
664+
origin_num - row_bitmap.cardinality(), origin_num, dist_fulfilled);
662665

663666
ann_index_stats = *stats;
664667
return Status::OK();

be/src/vec/exprs/vectorized_fn_call.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ class VectorizedFnCall : public VExpr {
9191
const std::vector<std::unique_ptr<segment_v2::IndexIterator>>& cid_to_index_iterators,
9292
const std::vector<ColumnId>& idx_to_cid,
9393
const std::vector<std::unique_ptr<segment_v2::ColumnIterator>>& column_iterators,
94-
roaring::Roaring& row_bitmap, segment_v2::AnnIndexStats& ann_index_stats) override;
94+
roaring::Roaring& row_bitmap, segment_v2::AnnIndexStats& ann_index_stats,
95+
AnnRangeSearchEvaluationResult& result) override;
9596

9697
void prepare_ann_range_search(const doris::VectorSearchUserParams& params,
9798
segment_v2::AnnRangeSearchRuntime& runtime,

be/src/vec/exprs/vexpr.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -991,7 +991,9 @@ Status VExpr::evaluate_ann_range_search(
991991
const std::vector<std::unique_ptr<segment_v2::IndexIterator>>& index_iterators,
992992
const std::vector<ColumnId>& idx_to_cid,
993993
const std::vector<std::unique_ptr<segment_v2::ColumnIterator>>& column_iterators,
994-
roaring::Roaring& row_bitmap, AnnIndexStats& ann_index_stats) {
994+
roaring::Roaring& row_bitmap, AnnIndexStats& ann_index_stats,
995+
AnnRangeSearchEvaluationResult& result) {
996+
result = {};
995997
return Status::OK();
996998
}
997999

@@ -1009,14 +1011,6 @@ void VExpr::prepare_ann_range_search(const doris::VectorSearchUserParams& params
10091011
}
10101012
}
10111013

1012-
bool VExpr::ann_range_search_executedd() {
1013-
return _has_been_executed;
1014-
}
1015-
1016-
bool VExpr::ann_dist_is_fulfilled() const {
1017-
return _virtual_column_is_fulfilled;
1018-
}
1019-
10201014
Status VExpr::execute_filter(VExprContext* context, const Block* block,
10211015
uint8_t* __restrict result_filter_data, size_t rows, bool accept_null,
10221016
bool* can_filter_all) const {

be/src/vec/exprs/vexpr.h

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,15 @@ namespace vectorized {
8484

8585
using Selector = IColumn::Selector;
8686

87+
struct AnnRangeSearchEvaluationResult {
88+
// Indicates whether the expr row_bitmap has been updated.
89+
bool executed = false;
90+
// Indicates whether the virtual column is fulfilled.
91+
// NOTE, if there is no virtual column in the expr tree, and expr
92+
// is evaluated by ann index, this flag is still true.
93+
bool dist_fulfilled = false;
94+
};
95+
8796
class VExpr {
8897
public:
8998
// resize inserted param column to make sure column size equal to block.rows() and return param column index
@@ -342,7 +351,8 @@ class VExpr {
342351
const std::vector<std::unique_ptr<segment_v2::IndexIterator>>& cid_to_index_iterators,
343352
const std::vector<ColumnId>& idx_to_cid,
344353
const std::vector<std::unique_ptr<segment_v2::ColumnIterator>>& column_iterators,
345-
roaring::Roaring& row_bitmap, segment_v2::AnnIndexStats& ann_index_stats);
354+
roaring::Roaring& row_bitmap, segment_v2::AnnIndexStats& ann_index_stats,
355+
AnnRangeSearchEvaluationResult& result);
346356

347357
// Prepare the runtime for ANN range search.
348358
// AnnRangeSearchRuntime is used to store the runtime information of ann range search.
@@ -352,10 +362,6 @@ class VExpr {
352362
segment_v2::AnnRangeSearchRuntime& range_search_runtime,
353363
bool& suitable_for_ann_index);
354364

355-
bool ann_range_search_executedd();
356-
357-
bool ann_dist_is_fulfilled() const;
358-
359365
protected:
360366
/// Simple debug string that provides no expr subclass-specific information
361367
std::string debug_string(const std::string& expr_name) const {
@@ -436,13 +442,6 @@ class VExpr {
436442
// ensuring uniqueness during index traversal
437443
uint32_t _index_unique_id = 0;
438444
bool _enable_inverted_index_query = true;
439-
440-
// Indicates whether the expr row_bitmap has been updated.
441-
bool _has_been_executed = false;
442-
// Indicates whether the virtual column is fulfilled.
443-
// NOTE, if there is no virtual column in the expr tree, and expr
444-
// is evaluated by ann index, this flag is still true.
445-
bool _virtual_column_is_fulfilled = false;
446445
};
447446

448447
} // namespace vectorized

be/src/vec/exprs/vexpr_context.cpp

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -433,41 +433,58 @@ Status VExprContext::evaluate_ann_range_search(
433433
const std::unordered_map<vectorized::VExprContext*,
434434
std::unordered_map<ColumnId, vectorized::VExpr*>>&
435435
common_expr_to_slotref_map,
436-
roaring::Roaring& row_bitmap, segment_v2::AnnIndexStats& ann_index_stats) {
436+
roaring::Roaring& row_bitmap, segment_v2::AnnIndexStats& ann_index_stats,
437+
bool* ann_range_search_executed) {
438+
if (ann_range_search_executed != nullptr) {
439+
*ann_range_search_executed = false;
440+
}
437441
if (_root == nullptr) {
438442
return Status::OK();
439443
}
440444

445+
AnnRangeSearchEvaluationResult evaluation_result;
441446
RETURN_IF_ERROR(_root->evaluate_ann_range_search(
442447
_ann_range_search_runtime, cid_to_index_iterators, idx_to_cid, column_iterators,
443-
row_bitmap, ann_index_stats));
448+
row_bitmap, ann_index_stats, evaluation_result));
444449

445-
if (!_root->ann_range_search_executedd()) {
450+
if (!evaluation_result.executed) {
446451
return Status::OK();
447452
}
453+
if (ann_range_search_executed != nullptr) {
454+
*ann_range_search_executed = true;
455+
}
456+
457+
DCHECK(_index_context != nullptr);
458+
_index_context->set_index_result_for_expr(
459+
_root.get(),
460+
segment_v2::InvertedIndexResultBitmap(std::make_shared<roaring::Roaring>(row_bitmap),
461+
std::make_shared<roaring::Roaring>()));
448462

449-
if (!_root->ann_dist_is_fulfilled()) {
463+
if (!evaluation_result.dist_fulfilled) {
450464
// Do not perform index scan in this case.
451465
return Status::OK();
452466
}
453467

454-
auto src_col_idx = _ann_range_search_runtime.src_col_idx;
468+
DCHECK_LT(_ann_range_search_runtime.src_col_idx, idx_to_cid.size());
469+
const auto src_col_idx = cast_set<int>(_ann_range_search_runtime.src_col_idx);
470+
const auto src_col_key = cast_set<ColumnId>(_ann_range_search_runtime.src_col_idx);
455471
auto slot_ref_map_it = common_expr_to_slotref_map.find(this);
456472
if (slot_ref_map_it == common_expr_to_slotref_map.end()) {
457473
return Status::OK();
458474
}
459475
auto& slot_ref_map = slot_ref_map_it->second;
460-
ColumnId cid = idx_to_cid[src_col_idx];
461-
if (slot_ref_map.find(cid) == slot_ref_map.end()) {
476+
auto slot_ref_it = slot_ref_map.find(src_col_key);
477+
if (slot_ref_it == slot_ref_map.end()) {
462478
return Status::OK();
463479
}
464-
const VExpr* slot_ref_expr_addr = slot_ref_map.find(cid)->second;
465-
_index_context->set_true_for_index_status(slot_ref_expr_addr, idx_to_cid[cid]);
480+
const VExpr* slot_ref_expr_addr = slot_ref_it->second;
481+
_index_context->set_true_for_index_status(slot_ref_expr_addr, src_col_idx);
466482

467483
VLOG_DEBUG << fmt::format(
468484
"Evaluate ann range search for expr {}, src_col_idx {}, cid {}, row_bitmap "
469485
"cardinality {}",
470-
_root->debug_string(), src_col_idx, cid, row_bitmap.cardinality());
486+
_root->debug_string(), src_col_idx, idx_to_cid[_ann_range_search_runtime.src_col_idx],
487+
row_bitmap.cardinality());
471488
return Status::OK();
472489
}
473490

be/src/vec/exprs/vexpr_context.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,8 @@ class VExprContext {
358358
const std::unordered_map<vectorized::VExprContext*,
359359
std::unordered_map<ColumnId, vectorized::VExpr*>>&
360360
common_expr_to_slotref_map,
361-
roaring::Roaring& row_bitmap, segment_v2::AnnIndexStats& ann_index_stats);
361+
roaring::Roaring& row_bitmap, segment_v2::AnnIndexStats& ann_index_stats,
362+
bool* ann_range_search_executed);
362363

363364
private:
364365
// Close method is called in vexpr context dector, not need call expicility

be/src/vec/exprs/virtual_slot_ref.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,12 +234,11 @@ Status VirtualSlotRef::evaluate_ann_range_search(
234234
const std::vector<std::unique_ptr<segment_v2::IndexIterator>>& cid_to_index_iterators,
235235
const std::vector<ColumnId>& idx_to_cid,
236236
const std::vector<std::unique_ptr<segment_v2::ColumnIterator>>& column_iterators,
237-
roaring::Roaring& row_bitmap, segment_v2::AnnIndexStats& ann_index_stats) {
237+
roaring::Roaring& row_bitmap, segment_v2::AnnIndexStats& ann_index_stats,
238+
AnnRangeSearchEvaluationResult& result) {
238239
return _virtual_column_expr->evaluate_ann_range_search(
239240
range_search_runtime, cid_to_index_iterators, idx_to_cid, column_iterators, row_bitmap,
240-
ann_index_stats);
241-
242-
return Status::OK();
241+
ann_index_stats, result);
243242
}
244243
#include "common/compile_check_end.h"
245244
} // namespace doris::vectorized

be/src/vec/exprs/virtual_slot_ref.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ class VirtualSlotRef MOCK_REMOVE(final) : public VExpr {
107107
const std::vector<std::unique_ptr<segment_v2::IndexIterator>>& cid_to_index_iterators,
108108
const std::vector<ColumnId>& idx_to_cid,
109109
const std::vector<std::unique_ptr<segment_v2::ColumnIterator>>& column_iterators,
110-
roaring::Roaring& row_bitmap, segment_v2::AnnIndexStats& ann_index_stats) override;
110+
roaring::Roaring& row_bitmap, segment_v2::AnnIndexStats& ann_index_stats,
111+
AnnRangeSearchEvaluationResult& result) override;
111112

112113
#ifdef BE_TEST
113114
// Test-only setter methods for unit testing

0 commit comments

Comments
 (0)