westonpace commented on code in PR #14292:
URL: https://github.com/apache/arrow/pull/14292#discussion_r1022356737
##########
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:
Rather than add a dummy project node can we solve this a different way?
This is ok but I think it adds complexity. Instead:
Can we modify `ConsumingSinkNodeOptions` so that it can take in `names` and
`metadata` (similar to `WriteNodeOptions`)?
Then, in the consuming sink node, can we attach the names and metadata to
the schema before we call `Init` on the consumer?
--
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]