vibhatha commented on code in PR #13401:
URL: https://github.com/apache/arrow/pull/13401#discussion_r956537882


##########
cpp/src/arrow/engine/substrait/plan_internal.cc:
##########
@@ -133,5 +136,18 @@ Result<ExtensionSet> GetExtensionSetFromPlan(const 
substrait::Plan& plan,
                             registry);
 }
 
+Result<std::unique_ptr<substrait::Plan>> PlanToProto(

Review Comment:
   The issue is that there is the same function signature in the 
`relation_internal.h`. What we do there is output the corresponding serialized 
`substrait::Rel` for a `Declaration`. Since the Substrait relation model 
entities are final classes which doesn't extend from a generic relation 
interface, what we do is create a `substrait::Rel` and fill the corresponding 
part. This is considered as a partial plan. For instance if the passed 
`Declaration` is a `scan` we populate the `read` in the `substrait::Rel` 
object. Then in the `plan_internal.cc` we extract that `read` component and 
bind to `substrait::Rel` which is considered as the full plan. In the 
`plan_internal.cc` what we do is we pass the `sink` to the `PlanToProto` to get 
the `substrait::Rel` which is recursively called until the whole plan is 
serialized. 
   
   So that's the reason for having this function signature to make clear and 
avoid compiler errors. Wanted to expose both interfaces to the user so that it 
can be used accordingly. 
   
   



-- 
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]

Reply via email to