Skip to content
Closed
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: 0 additions & 3 deletions be/src/vec/exprs/vexpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ VExpr::VExpr(const TypeDescriptor& type, bool is_slotref, bool is_nullable)
}

Status VExpr::prepare(RuntimeState* state, const RowDescriptor& row_desc, VExprContext* context) {
for (int i = 0; i < _children.size(); ++i) {
RETURN_IF_ERROR(_children[i]->prepare(state, row_desc, context));
}
return Status::OK();
}

Expand Down
20 changes: 19 additions & 1 deletion be/src/vec/exprs/vexpr_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,25 @@ doris::Status VExprContext::prepare(doris::RuntimeState* state,
const doris::RowDescriptor& row_desc) {
_prepared = true;
_pool.reset(new MemPool());
return _root->prepare(state, row_desc, this);
std::stack<VExpr*> stack;
stack.push(_root);

std::vector<VExpr*> flatted;

while (!stack.empty()) {
auto* top = stack.top();
flatted.emplace_back(top);
stack.pop();
for (auto* child : top->children()) {
stack.push(child);
}
}

for (ssize_t i = flatted.size() - 1; i >= 0; --i) {
RETURN_IF_ERROR(flatted[i]->prepare(state, row_desc, this));
}

return Status::OK();
}

doris::Status VExprContext::open(doris::RuntimeState* state) {
Expand Down