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
3 changes: 3 additions & 0 deletions be/src/common/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,9 @@ CONF_Int32(num_broadcast_buffer, "32");
// semi-structure configs
CONF_Bool(enable_parse_multi_dimession_array, "true");

// max depth of expression tree allowed.
CONF_Int32(max_depth_of_expr_tree, "200");

// Report a tablet as bad when io errors occurs more than this value.
CONF_mInt64(max_tablet_io_errors, "-1");

Expand Down
8 changes: 8 additions & 0 deletions be/src/vec/exprs/vexpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,17 @@ VExpr::VExpr(const TypeDescriptor& type, bool is_slotref, bool is_nullable)
}

Status VExpr::prepare(RuntimeState* state, const RowDescriptor& row_desc, VExprContext* context) {
++context->_depth_num;
if (context->_depth_num > config::max_depth_of_expr_tree) {
return Status::InternalError(
"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/vec/exprs/vexpr_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ class VExprContext {

int _last_result_column_id;

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

bool _stale;
};
} // namespace doris::vectorized