westonpace commented on a change in pull request #12672:
URL: https://github.com/apache/arrow/pull/12672#discussion_r835620641



##########
File path: cpp/src/arrow/engine/substrait/util.cc
##########
@@ -0,0 +1,106 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "arrow/engine/substrait/util.h"
+
+namespace arrow {
+
+namespace engine {
+
+Status SubstraitSinkConsumer::Consume(cp::ExecBatch batch) {
+  // Consume a batch of data
+  bool did_push = producer_.Push(batch);
+  if (!did_push) return Status::ExecutionError("Producer closed already");
+  return Status::OK();
+}
+
+Future<> SubstraitSinkConsumer::Finish() {

Review comment:
       My guess is that you are thinking of `SinkNode` which is very similar to 
this class.
   
   Right now the Substrait consumer always uses a `ConsumingSinkNode` and thus 
it needs a "consumer factory".
   
   Another potential implementation would be for the Substrait to take in a 
"sink node factory" instead (or we could have both implementations).  That 
might be more flexible in the long term.  In that case we could reuse 
`SinkNode` here.
   
   So we have `SinkNode` which is a "node that shoves batches into a push 
generator" and we have `SubstraitSinkConsumer` which is a "consumer that shoves 
batches into a push generator".




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