diff --git a/be/src/pipeline/exec/olap_scan_operator.cpp b/be/src/pipeline/exec/olap_scan_operator.cpp index 09e999d4737e12..2696e426786b98 100644 --- a/be/src/pipeline/exec/olap_scan_operator.cpp +++ b/be/src/pipeline/exec/olap_scan_operator.cpp @@ -164,16 +164,13 @@ Status OlapScanLocalState::_process_conjuncts(RuntimeState* state) { } bool OlapScanLocalState::_is_key_column(const std::string& key_name) { - auto& p = _parent->cast(); // all column in dup_keys table or unique_keys with merge on write table olap scan node threat // as key column - if (p._olap_scan_node.keyType == TKeysType::DUP_KEYS || - (p._olap_scan_node.keyType == TKeysType::UNIQUE_KEYS && - p._olap_scan_node.__isset.enable_unique_key_merge_on_write && - p._olap_scan_node.enable_unique_key_merge_on_write)) { + if (_storage_no_merge()) { return true; } + auto& p = _parent->cast(); auto res = std::find(p._olap_scan_node.key_column_name.begin(), p._olap_scan_node.key_column_name.end(), key_name); return res != p._olap_scan_node.key_column_name.end(); diff --git a/be/src/pipeline/exec/olap_scan_operator.h b/be/src/pipeline/exec/olap_scan_operator.h index 4465ce5690e703..4aa9a2322259f3 100644 --- a/be/src/pipeline/exec/olap_scan_operator.h +++ b/be/src/pipeline/exec/olap_scan_operator.h @@ -79,7 +79,7 @@ class OlapScanLocalState final : public ScanLocalState { if (!predicate.target_is_slot(_parent->node_id())) { return false; } - return _is_key_column(predicate.get_col_name(_parent->node_id())) || _storage_no_merge(); + return _is_key_column(predicate.get_col_name(_parent->node_id())); } Status _init_scanners(std::list* scanners) override; diff --git a/be/src/pipeline/exec/scan_operator.cpp b/be/src/pipeline/exec/scan_operator.cpp index b7dc78bf8f1c1d..081b0b9625b992 100644 --- a/be/src/pipeline/exec/scan_operator.cpp +++ b/be/src/pipeline/exec/scan_operator.cpp @@ -305,18 +305,15 @@ Status ScanLocalState::_normalize_predicate( RETURN_IF_PUSH_DOWN(_normalize_noneq_binary_predicate( cur_expr, context, slot, value_range, &pdt), status); - if (_is_key_column(slot->col_name())) { + RETURN_IF_PUSH_DOWN( + _normalize_bitmap_filter(cur_expr, context, slot, &pdt), + status); + RETURN_IF_PUSH_DOWN( + _normalize_bloom_filter(cur_expr, context, slot, &pdt), status); + if (state()->enable_function_pushdown()) { RETURN_IF_PUSH_DOWN( - _normalize_bitmap_filter(cur_expr, context, slot, &pdt), + _normalize_function_filters(cur_expr, context, slot, &pdt), status); - RETURN_IF_PUSH_DOWN( - _normalize_bloom_filter(cur_expr, context, slot, &pdt), - status); - if (state()->enable_function_pushdown()) { - RETURN_IF_PUSH_DOWN(_normalize_function_filters( - cur_expr, context, slot, &pdt), - status); - } } }, *range); @@ -330,8 +327,7 @@ Status ScanLocalState::_normalize_predicate( return Status::OK(); } - if (pdt == PushDownType::ACCEPTABLE && - (_is_key_column(slot->col_name()) || _storage_no_merge())) { + if (pdt == PushDownType::ACCEPTABLE && (_is_key_column(slot->col_name()))) { output_expr = nullptr; return Status::OK(); } else { @@ -524,7 +520,7 @@ Status ScanLocalState::_eval_const_conjuncts(vectorized::VExpr* vexpr, if (vexpr->is_constant()) { std::shared_ptr const_col_wrapper; RETURN_IF_ERROR(vexpr->get_const_col(expr_ctx, &const_col_wrapper)); - if (const vectorized::ColumnConst* const_column = + if (const auto* const_column = check_and_get_column(const_col_wrapper->column_ptr)) { constant_val = const_cast(const_column->get_data_at(0).data); if (constant_val == nullptr || !*reinterpret_cast(constant_val)) { @@ -532,7 +528,7 @@ Status ScanLocalState::_eval_const_conjuncts(vectorized::VExpr* vexpr, _eos = true; _scan_dependency->set_ready(); } - } else if (const vectorized::ColumnVector* bool_column = + } else if (const auto* bool_column = check_and_get_column>( const_col_wrapper->column_ptr)) { // TODO: If `vexpr->is_constant()` is true, a const column is expected here. @@ -583,24 +579,21 @@ Status ScanLocalState::_normalize_in_and_eq_predicate(vectorized::VExpr if (hybrid_set->size() <= _parent->cast()._max_pushdown_conditions_per_column) { iter = hybrid_set->begin(); - } else if (_is_key_column(slot->col_name()) || _storage_no_merge()) { + } else { _filter_predicates.in_filters.emplace_back(slot->col_name(), expr->get_set_func()); *pdt = PushDownType::ACCEPTABLE; return Status::OK(); - } else { - *pdt = PushDownType::UNACCEPTABLE; - return Status::OK(); } } else { // normal in predicate - vectorized::VInPredicate* pred = static_cast(expr); + auto* pred = static_cast(expr); PushDownType temp_pdt = _should_push_down_in_predicate(pred, expr_ctx, false); if (temp_pdt == PushDownType::UNACCEPTABLE) { return Status::OK(); } // begin to push InPredicate value into ColumnValueRange - vectorized::InState* state = reinterpret_cast( + auto* state = reinterpret_cast( expr_ctx->fn_context(pred->fn_context_index()) ->get_function_state(FunctionContext::FRAGMENT_LOCAL)); @@ -619,7 +612,7 @@ Status ScanLocalState::_normalize_in_and_eq_predicate(vectorized::VExpr iter->next(); continue; } - auto value = const_cast(iter->get_value()); + auto* value = const_cast(iter->get_value()); RETURN_IF_ERROR(_change_value_range( temp_range, value, ColumnValueRange::add_fixed_value_range, "")); iter->next();