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


##########
cpp/src/arrow/engine/substrait/serde.cc:
##########
@@ -124,6 +107,24 @@ compute::Declaration 
ProjectByNamesDeclaration(compute::Declaration input,
         compute::ProjectNodeOptions{std::move(expressions), 
std::move(names)}}});
 }
 
+DeclarationFactory MakeConsumingSinkDeclarationFactory(
+    const ConsumerFactory& consumer_factory) {
+  return [&consumer_factory](
+             compute::Declaration input,
+             std::vector<std::string> names) -> Result<compute::Declaration> {
+    std::shared_ptr<compute::SinkNodeConsumer> consumer = consumer_factory();
+    if (consumer == nullptr) {
+      return Status::Invalid("consumer factory is exhausted");
+    }
+    std::shared_ptr<compute::ExecNodeOptions> options =
+        std::make_shared<compute::ConsumingSinkNodeOptions>(
+            compute::ConsumingSinkNodeOptions{std::move(consumer), 
std::move(names)});
+    compute::Declaration projected = ProjectByNamesDeclaration(input, names);
+    return compute::Declaration::Sequence(
+        {std::move(projected), {"consuming_sink", options}});
+  };

Review Comment:
   Yeah, that could work. I will check.



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