[refactor](remove expr) remove non vectorized Expr and ExprContext related codes (#16136)

This commit is contained in:
yiguolei
2023-01-24 10:45:35 +08:00
committed by GitHub
parent 23edb3de5a
commit 79ad74637d
176 changed files with 319 additions and 15367 deletions

View File

@ -27,7 +27,6 @@
#include "common/object_pool.h"
#include "common/status.h"
#include "exprs/expr_context.h"
#include "runtime/descriptors.h"
#include "runtime/exec_env.h"
#include "runtime/memory/mem_tracker.h"
@ -84,31 +83,6 @@ ExecNode::ExecNode(ObjectPool* pool, const TPlanNode& tnode, const DescriptorTbl
ExecNode::~ExecNode() = default;
void ExecNode::push_down_predicate(RuntimeState* state, std::list<ExprContext*>* expr_ctxs) {
if (_type != TPlanNodeType::AGGREGATION_NODE) {
for (int i = 0; i < _children.size(); ++i) {
_children[i]->push_down_predicate(state, expr_ctxs);
if (expr_ctxs->size() == 0) {
return;
}
}
}
std::list<ExprContext*>::iterator iter = expr_ctxs->begin();
while (iter != expr_ctxs->end()) {
if ((*iter)->root()->is_bound(&_tuple_ids)) {
// LOG(INFO) << "push down success expr is " << (*iter)->debug_string()
// << " and node is " << debug_string();
(*iter)->prepare(state, row_desc());
(*iter)->open(state);
_conjunct_ctxs.push_back(*iter);
iter = expr_ctxs->erase(iter);
} else {
++iter;
}
}
}
Status ExecNode::init(const TPlanNode& tnode, RuntimeState* state) {
init_runtime_profile(get_name());
@ -117,10 +91,6 @@ Status ExecNode::init(const TPlanNode& tnode, RuntimeState* state) {
RETURN_IF_ERROR(doris::vectorized::VExpr::create_expr_tree(_pool, tnode.vconjunct,
_vconjunct_ctx_ptr.get()));
}
if (typeid(*this) != typeid(doris::vectorized::NewOlapScanNode) &&
typeid(*this) != typeid(doris::vectorized::NewFileScanNode)) {
RETURN_IF_ERROR(Expr::create_expr_trees(_pool, tnode.conjuncts, &_conjunct_ctxs));
}
// create the projections expr
if (tnode.__isset.projections) {
@ -148,13 +118,6 @@ Status ExecNode::prepare(RuntimeState* state) {
RETURN_IF_ERROR((*_vconjunct_ctx_ptr)->prepare(state, intermediate_row_desc()));
}
// For vectorized olap scan node, the conjuncts is prepared in _vconjunct_ctx_ptr.
// And _conjunct_ctxs is useless.
// TODO: Should be removed when non-vec engine is removed.
if (typeid(*this) != typeid(doris::vectorized::NewOlapScanNode) &&
typeid(*this) != typeid(doris::vectorized::NewFileScanNode)) {
RETURN_IF_ERROR(Expr::prepare(_conjunct_ctxs, state, _row_descriptor));
}
RETURN_IF_ERROR(vectorized::VExpr::prepare(_projections, state, intermediate_row_desc()));
for (int i = 0; i < _children.size(); ++i) {
@ -169,12 +132,7 @@ Status ExecNode::alloc_resource(doris::RuntimeState* state) {
RETURN_IF_ERROR((*_vconjunct_ctx_ptr)->open(state));
}
RETURN_IF_ERROR(vectorized::VExpr::open(_projections, state));
if (typeid(*this) != typeid(doris::vectorized::NewOlapScanNode) &&
typeid(*this) != typeid(doris::vectorized::NewFileScanNode)) {
return Expr::open(_conjunct_ctxs, state);
} else {
return Status::OK();
}
return Status::OK();
}
Status ExecNode::open(RuntimeState* state) {
@ -206,10 +164,6 @@ void ExecNode::release_resource(doris::RuntimeState* state) {
if (_vconjunct_ctx_ptr) {
(*_vconjunct_ctx_ptr)->close(state);
}
if (typeid(*this) != typeid(doris::vectorized::NewOlapScanNode) &&
typeid(*this) != typeid(doris::vectorized::NewFileScanNode)) {
Expr::close(_conjunct_ctxs, state);
}
vectorized::VExpr::close(_projections, state);
runtime_profile()->add_to_span();
@ -486,7 +440,6 @@ std::string ExecNode::debug_string() const {
}
void ExecNode::debug_string(int indentation_level, std::stringstream* out) const {
*out << " conjuncts=" << Expr::debug_string(_conjuncts);
*out << " id=" << _id;
*out << " type=" << print_plan_node_type(_type);
*out << " tuple_ids=[";
@ -501,16 +454,6 @@ void ExecNode::debug_string(int indentation_level, std::stringstream* out) const
}
}
bool ExecNode::eval_conjuncts(ExprContext* const* ctxs, int num_ctxs, TupleRow* row) {
for (int i = 0; i < num_ctxs; ++i) {
BooleanVal v = ctxs[i]->get_boolean_val(row);
if (v.is_null || !v.val) {
return false;
}
}
return true;
}
void ExecNode::collect_nodes(TPlanNodeType::type node_type, std::vector<ExecNode*>* nodes) {
if (_type == node_type) {
nodes->push_back(this);