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 08:28:34 UTC

[GitHub] [arrow] rtpsw commented on a diff in pull request #12672: ARROW-15779: [Python] Create python bindings for Substrait consumer

rtpsw commented on code in PR #12672:
URL: https://github.com/apache/arrow/pull/12672#discussion_r876743296


##########
python/pyarrow/_substrait.pyx:
##########
@@ -0,0 +1,79 @@
+# 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.
+
+# cython: language_level = 3
+from cython.operator cimport dereference as deref
+
+from pyarrow import Buffer
+from pyarrow.lib cimport *
+from pyarrow.includes.libarrow cimport *
+from pyarrow.libarrow_substrait cimport *
+
+
+def run_query(plan):

Review Comment:
   I have experimental PyArrow/Substrait code that runs a Substrait plan and returns types other than `RecordBatchReader`. Since there are other return types of interest, I'd suggest including something like "read" in this method's name, e.g. `run_query_as_reader`.



##########
python/pyarrow/libarrow_substrait.pxd:
##########
@@ -0,0 +1,26 @@
+# Licensed to the Apache Software Foundation (ASF) under one

Review Comment:
   Small comment: Judging by similar files in Arrow, this file should probably be located under `python/pyarrow/includes`.



##########
cpp/src/arrow/engine/substrait/util.cc:
##########
@@ -0,0 +1,129 @@
+// 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"
+#include "arrow/util/async_generator.h"
+#include "arrow/util/async_util.h"
+
+namespace arrow {
+
+namespace engine {
+
+namespace substrait {
+
+namespace {
+/// \brief A SinkNodeConsumer specialized to output ExecBatches via PushGenerator
+class SubstraitSinkConsumer : public compute::SinkNodeConsumer {

Review Comment:
   This seems useful more generally than just for Substrait, and it doesn't depend on Substrait, so consider moving this to `arrow/engine`.



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