Skip to content

Commit 0772de6

Browse files
committed
update
1 parent 6384827 commit 0772de6

File tree

1 file changed

+52
-48
lines changed

1 file changed

+52
-48
lines changed

be/src/pipeline/exec/scan_operator.cpp

Lines changed: 52 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -347,49 +347,63 @@ Status ScanLocalState<Derived>::_normalize_predicate(vectorized::VExprContext* c
347347
std::visit(
348348
[&](auto& value_range) {
349349
auto expr = root->is_rf_wrapper() ? root->get_impl() : root;
350-
switch (expr->node_type()) {
351-
case TExprNodeType::IN_PRED:
352-
RETURN_IF_PUSH_DOWN(
353-
_normalize_in_predicate(context, expr, slot,
354-
_slot_id_to_predicates[slot->id()],
355-
value_range, &pdt),
356-
status);
357-
break;
358-
case TExprNodeType::BINARY_PRED:
359-
RETURN_IF_PUSH_DOWN(
360-
_normalize_binary_predicate(context, expr, slot,
350+
{
351+
Defer attach_defer = [&]() {
352+
if (pdt != PushDownType::UNACCEPTABLE && root->is_rf_wrapper()) {
353+
auto* rf_expr =
354+
assert_cast<vectorized::VRuntimeFilterWrapper*>(root.get());
355+
_slot_id_to_predicates[slot->id()].back()->attach_profile_counter(
356+
rf_expr->filter_id(),
357+
rf_expr->predicate_filtered_rows_counter(),
358+
rf_expr->predicate_input_rows_counter(),
359+
rf_expr->predicate_always_true_rows_counter());
360+
}
361+
};
362+
switch (expr->node_type()) {
363+
case TExprNodeType::IN_PRED:
364+
RETURN_IF_PUSH_DOWN(
365+
_normalize_in_predicate(context, expr, slot,
361366
_slot_id_to_predicates[slot->id()],
362367
value_range, &pdt),
363-
status);
364-
break;
365-
case TExprNodeType::FUNCTION_CALL:
366-
if (expr->is_topn_filter()) {
367-
RETURN_IF_PUSH_DOWN(_normalize_topn_filter(
368-
context, expr, slot,
369-
_slot_id_to_predicates[slot->id()], &pdt),
370-
status);
371-
} else {
368+
status);
369+
break;
370+
case TExprNodeType::BINARY_PRED:
372371
RETURN_IF_PUSH_DOWN(
373-
_normalize_is_null_predicate(context, expr, slot,
374-
_slot_id_to_predicates[slot->id()],
375-
value_range, &pdt),
372+
_normalize_binary_predicate(context, expr, slot,
373+
_slot_id_to_predicates[slot->id()],
374+
value_range, &pdt),
376375
status);
377-
}
378-
break;
379-
case TExprNodeType::BITMAP_PRED:
380-
RETURN_IF_PUSH_DOWN(
381-
_normalize_bitmap_filter(context, root, slot,
382-
_slot_id_to_predicates[slot->id()], &pdt),
383-
status);
384-
break;
385-
case TExprNodeType::BLOOM_PRED:
386-
RETURN_IF_PUSH_DOWN(
387-
_normalize_bloom_filter(context, root, slot,
376+
break;
377+
case TExprNodeType::FUNCTION_CALL:
378+
if (expr->is_topn_filter()) {
379+
RETURN_IF_PUSH_DOWN(
380+
_normalize_topn_filter(context, expr, slot,
381+
_slot_id_to_predicates[slot->id()],
382+
&pdt),
383+
status);
384+
} else {
385+
RETURN_IF_PUSH_DOWN(_normalize_is_null_predicate(
386+
context, expr, slot,
387+
_slot_id_to_predicates[slot->id()],
388+
value_range, &pdt),
389+
status);
390+
}
391+
break;
392+
case TExprNodeType::BITMAP_PRED:
393+
RETURN_IF_PUSH_DOWN(_normalize_bitmap_filter(
394+
context, root, slot,
395+
_slot_id_to_predicates[slot->id()], &pdt),
396+
status);
397+
break;
398+
case TExprNodeType::BLOOM_PRED:
399+
RETURN_IF_PUSH_DOWN(_normalize_bloom_filter(
400+
context, root, slot,
388401
_slot_id_to_predicates[slot->id()], &pdt),
389-
status);
390-
break;
391-
default:
392-
break;
402+
status);
403+
break;
404+
default:
405+
break;
406+
}
393407
}
394408
// `node_type` of function filter is FUNCTION_CALL or COMPOUND_PRED
395409
if (state()->enable_function_pushdown()) {
@@ -437,16 +451,11 @@ Status ScanLocalState<Derived>::_normalize_bloom_filter(
437451
DCHECK(root->is_rf_wrapper());
438452
*pdt = _should_push_down_bloom_filter();
439453
if (*pdt != PushDownType::UNACCEPTABLE) {
440-
auto* rf_expr = assert_cast<vectorized::VRuntimeFilterWrapper*>(root.get());
441454
pred = create_bloom_filter_predicate(
442455
_parent->intermediate_row_desc().get_column_id(slot->id()), slot->col_name(),
443456
slot->type()->get_primitive_type() == TYPE_VARIANT ? expr->get_child(0)->data_type()
444457
: slot->type(),
445458
expr->get_bloom_filter_func());
446-
pred->attach_profile_counter(rf_expr->filter_id(),
447-
rf_expr->predicate_filtered_rows_counter(),
448-
rf_expr->predicate_input_rows_counter(),
449-
rf_expr->predicate_always_true_rows_counter());
450459
}
451460
return Status::OK();
452461
}
@@ -492,16 +501,11 @@ Status ScanLocalState<Derived>::_normalize_bitmap_filter(
492501
if (*pdt != PushDownType::UNACCEPTABLE) {
493502
DCHECK(expr->get_num_children() == 1);
494503
DCHECK(root->is_rf_wrapper());
495-
auto* rf_expr = assert_cast<vectorized::VRuntimeFilterWrapper*>(root.get());
496504
pred = create_bitmap_filter_predicate(
497505
_parent->intermediate_row_desc().get_column_id(slot->id()), slot->col_name(),
498506
slot->type()->get_primitive_type() == TYPE_VARIANT ? expr->get_child(0)->data_type()
499507
: slot->type(),
500508
expr->get_bitmap_filter_func());
501-
pred->attach_profile_counter(rf_expr->filter_id(),
502-
rf_expr->predicate_filtered_rows_counter(),
503-
rf_expr->predicate_input_rows_counter(),
504-
rf_expr->predicate_always_true_rows_counter());
505509
}
506510
return Status::OK();
507511
}

0 commit comments

Comments
 (0)