[refactor](exec) replace the single pointer with an array of 'conjuncts' in ExecNode (#19758)
Refactoring the filtering conditions in the current ExecNode from an expression tree to an array can simplify the process of adding runtime filters. It eliminates the need for complex merge operations and removes the requirement for the frontend to combine expressions into a single entity. By representing the filtering conditions as an array, each condition can be treated individually, making it easier to add runtime filters without the need for complex merging logic. The array can store the individual conditions, and the runtime filter logic can iterate through the array to apply the filters as needed. This refactoring simplifies the codebase, improves readability, and reduces the complexity associated with handling filtering conditions and adding runtime filters. It separates the conditions into discrete entities, enabling more straightforward manipulation and management within the execution node.
This commit is contained in:
@ -147,8 +147,7 @@ AggregationNode::~AggregationNode() = default;
|
||||
Status AggregationNode::init(const TPlanNode& tnode, RuntimeState* state) {
|
||||
RETURN_IF_ERROR(ExecNode::init(tnode, state));
|
||||
// ignore return status for now , so we need to introduce ExecNode::init()
|
||||
RETURN_IF_ERROR(
|
||||
VExpr::create_expr_trees(_pool, tnode.agg_node.grouping_exprs, &_probe_expr_ctxs));
|
||||
RETURN_IF_ERROR(VExpr::create_expr_trees(tnode.agg_node.grouping_exprs, _probe_expr_ctxs));
|
||||
|
||||
// init aggregate functions
|
||||
_aggregate_evaluators.reserve(tnode.agg_node.aggregate_functions.size());
|
||||
@ -181,7 +180,7 @@ Status AggregationNode::init(const TPlanNode& tnode, RuntimeState* state) {
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
void AggregationNode::_init_hash_method(std::vector<VExprContext*>& probe_exprs) {
|
||||
void AggregationNode::_init_hash_method(const VExprContextSPtrs& probe_exprs) {
|
||||
DCHECK(probe_exprs.size() >= 1);
|
||||
if (probe_exprs.size() == 1) {
|
||||
auto is_nullable = probe_exprs[0]->root()->is_nullable();
|
||||
@ -262,8 +261,8 @@ void AggregationNode::_init_hash_method(std::vector<VExprContext*>& probe_exprs)
|
||||
|
||||
_probe_key_sz.resize(_probe_expr_ctxs.size());
|
||||
for (int i = 0; i < _probe_expr_ctxs.size(); ++i) {
|
||||
const auto vexpr = _probe_expr_ctxs[i]->root();
|
||||
const auto& data_type = vexpr->data_type();
|
||||
const auto& expr = _probe_expr_ctxs[i]->root();
|
||||
const auto& data_type = expr->data_type();
|
||||
|
||||
if (!data_type->have_maximum_size_of_value()) {
|
||||
use_fixed_key = false;
|
||||
@ -473,9 +472,9 @@ Status AggregationNode::prepare_profile(RuntimeState* state) {
|
||||
std::bind<void>(&AggregationNode::_update_memusage_with_serialized_key, this);
|
||||
_executor.close = std::bind<void>(&AggregationNode::_close_with_serialized_key, this);
|
||||
|
||||
_should_limit_output = _limit != -1 && // has limit
|
||||
_vconjunct_ctx_ptr == nullptr && // no having conjunct
|
||||
_needs_finalize; // agg's finalize step
|
||||
_should_limit_output = _limit != -1 && // has limit
|
||||
_conjuncts.empty() && // no having conjunct
|
||||
_needs_finalize; // agg's finalize step
|
||||
}
|
||||
|
||||
return Status::OK();
|
||||
@ -578,7 +577,7 @@ Status AggregationNode::pull(doris::RuntimeState* state, vectorized::Block* bloc
|
||||
RETURN_IF_ERROR(_executor.get_result(state, block, eos));
|
||||
_make_nullable_output_key(block);
|
||||
// dispose the having clause, should not be execute in prestreaming agg
|
||||
RETURN_IF_ERROR(VExprContext::filter_block(_vconjunct_ctx_ptr, block, block->columns()));
|
||||
RETURN_IF_ERROR(VExprContext::filter_block(_conjuncts, block, block->columns()));
|
||||
reached_limit(block, eos);
|
||||
|
||||
return Status::OK();
|
||||
|
||||
Reference in New Issue
Block a user