vibhatha commented on a change in pull request #12275: URL: https://github.com/apache/arrow/pull/12275#discussion_r796296989
########## File path: cpp/src/arrow/compute/exec/sink_node.cc ########## @@ -232,6 +232,77 @@ class ConsumingSinkNode : public ExecNode { std::shared_ptr<SinkNodeConsumer> consumer_; }; +/** + * @brief This node is an extension on ConsumingSinkNode + * to facilitate to get the output from an execution plan + * as a table. We define a custom SinkNodeConsumer to + * enable this functionality. + */ + +struct TableSinkNodeConsumer : public arrow::compute::SinkNodeConsumer { + public: + TableSinkNodeConsumer(std::shared_ptr<Table>* out, + std::shared_ptr<Schema> output_schema, MemoryPool* pool, + Future<> finish) + : out_(out), + output_schema_(output_schema), + pool_(pool), + finish_(std::move(finish)) {} + + Status Consume(ExecBatch batch) override { + ARROW_ASSIGN_OR_RAISE(auto rb, batch.ToRecordBatch(output_schema_, pool_)); Review comment: I added a lock. -- 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-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org