yiguolei commented on code in PR #19758:
URL: https://github.com/apache/doris/pull/19758#discussion_r1196549961


##########
be/src/vec/exprs/vexpr.cpp:
##########
@@ -269,6 +269,55 @@ Status VExpr::create_tree_from_thrift(doris::ObjectPool* 
pool,
     return Status::OK();
 }
 
+Status VExpr::create_tree_from_thrift(doris::ObjectPool* pool,
+                                      const std::vector<doris::TExprNode>& 
nodes, int* node_idx,
+                                      VExpr** root_expr, 
std::shared_ptr<VExprContext>& ctx) {
+    // propagate error case
+    if (*node_idx >= nodes.size()) {
+        return Status::InternalError("Failed to reconstruct expression tree 
from thrift.");
+    }
+
+    // create root expr
+    int root_children = nodes[*node_idx].num_children;
+    VExpr* root = nullptr;
+    RETURN_IF_ERROR(create_expr(pool, nodes[*node_idx], &root));
+    DCHECK(root != nullptr);
+
+    DCHECK(root_expr != nullptr);
+    DCHECK(ctx == nullptr);
+    *root_expr = root;
+    ctx.reset(VExprContext::create_unique(root).release());

Review Comment:
   there is create_shared method, not need create unique and then release.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to