westonpace commented on code in PR #13181:
URL: https://github.com/apache/arrow/pull/13181#discussion_r877107802


##########
cpp/src/arrow/engine/substrait/serde.cc:
##########
@@ -86,6 +86,20 @@ Result<std::vector<compute::Declaration>> DeserializePlan(
   return sink_decls;
 }
 
+Result<compute::ExecPlan> DeserializePlan(const Buffer& buf,
+                                          const ConsumerFactory& 
consumer_factory,
+                                          ExtensionSet* ext_set_out) {
+  ARROW_ASSIGN_OR_RAISE(auto declarations,
+                        DeserializePlans(buf, consumer_factory, ext_set_out));
+  if (declarations.size() > 1) {
+    return Status::Invalid("Substrait plan cannot have multiple root 
relations");

Review Comment:
   ```suggestion
       return Status::Invalid("DeserializePlan does not support root 
relations");
   ```
   Technically a Substrait plan can have multiple root relations.  We just 
don't support those plans in this method.



##########
cpp/src/arrow/engine/substrait/serde.h:
##########
@@ -48,9 +48,12 @@ using ConsumerFactory = 
std::function<std::shared_ptr<compute::SinkNodeConsumer>
 /// returned here.
 /// \return a vector of ExecNode declarations, one for each toplevel relation 
in the
 /// Substrait Plan
-ARROW_ENGINE_EXPORT Result<std::vector<compute::Declaration>> DeserializePlan(
-    const Buffer& buf, const ConsumerFactory& consumer_factory,
-    ExtensionSet* ext_set = NULLPTR);
+ARROW_ENGINE_EXPORT Result<std::vector<compute::Declaration>> DeserializePlans(
+    const Buffer& buf, const ConsumerFactory& consumer_factory, ExtensionSet* 
ext_set);

Review Comment:
   ```suggestion
       const Buffer& buf, const ConsumerFactory& consumer_factory, 
ExtensionSet* ext_set = NULLPTR);
   ```
   I think we still need the default value here.



##########
cpp/src/arrow/engine/substrait/serde.cc:
##########
@@ -86,6 +86,20 @@ Result<std::vector<compute::Declaration>> DeserializePlan(
   return sink_decls;
 }
 
+Result<compute::ExecPlan> DeserializePlan(const Buffer& buf,
+                                          const ConsumerFactory& 
consumer_factory,
+                                          ExtensionSet* ext_set_out) {

Review Comment:
   I do like the name `ext_set_out` more than `ext_set`.  Could you update the 
name in the header as well so they match?



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