You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/05/19 14:10:52 UTC

[GitHub] [arrow] westonpace commented on a diff in pull request #13181: ARROW-15534: [C++] Add convenience function to substrait consumer to create plan instead of declaration

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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org