Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions be/src/exprs/expr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -524,9 +524,17 @@ Status Expr::prepare(const std::vector<ExprContext*>& ctxs, RuntimeState* state,

Status Expr::prepare(RuntimeState* state, const RowDescriptor& row_desc, ExprContext* context) {
DCHECK(_type.type != INVALID_TYPE);
++context->_depth_num;
if (context->_depth_num > config::max_depth_of_expr_tree) {
return Status::InternalError(
fmt::format("The depth of the expression tree is too big, make it less than {}",
config::max_depth_of_expr_tree));
}
for (int i = 0; i < _children.size(); ++i) {
RETURN_IF_ERROR(_children[i]->prepare(state, row_desc, context));
}

--context->_depth_num;
return Status::OK();
}

Expand Down
3 changes: 3 additions & 0 deletions be/src/exprs/expr_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ class ExprContext {
/// Calls the appropriate Get*Val() function on 'e' and stores the result in result_.
/// This is used by Exprs to call GetValue() on a child expr, rather than root_.
void* get_value(Expr* e, TupleRow* row, int precision = 0, int scale = 0);

/// The depth of expression-tree.
int _depth_num = 0;
};

inline void* ExprContext::get_value(TupleRow* row) {
Expand Down