[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:
Jerry Hu
2023-05-29 11:47:31 +08:00
committed by GitHub
parent 970efdc1cb
commit 9f8de89659
174 changed files with 1179 additions and 1332 deletions

View File

@ -48,15 +48,15 @@ Status VTableFunctionNode::init(const TPlanNode& tnode, RuntimeState* state) {
RETURN_IF_ERROR(ExecNode::init(tnode, state));
for (const TExpr& texpr : tnode.table_function_node.fnCallExprList) {
VExprContext* ctx = nullptr;
RETURN_IF_ERROR(VExpr::create_expr_tree(_pool, texpr, &ctx));
VExprContextSPtr ctx;
RETURN_IF_ERROR(VExpr::create_expr_tree(texpr, ctx));
_vfn_ctxs.push_back(ctx);
VExpr* root = ctx->root();
auto root = ctx->root();
const std::string& tf_name = root->fn().name.function_name;
TableFunction* fn = nullptr;
RETURN_IF_ERROR(TableFunctionFactory::get_fn(tf_name, _pool, &fn));
fn->set_vexpr_context(ctx);
fn->set_expr_context(ctx);
_fns.push_back(fn);
}
_fn_num = _fns.size();
@ -236,8 +236,7 @@ Status VTableFunctionNode::_get_expanded_block(RuntimeState* state, Block* outpu
}
// 3. eval conjuncts
RETURN_IF_ERROR(
VExprContext::filter_block(_vconjunct_ctx_ptr, output_block, output_block->columns()));
RETURN_IF_ERROR(VExprContext::filter_block(_conjuncts, output_block, output_block->columns()));
*eos = _child_eos && _cur_child_offset == -1;
return Status::OK();