You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "andygrove (via GitHub)" <gi...@apache.org> on 2023/02/04 13:45:29 UTC

[GitHub] [arrow-datafusion] andygrove opened a new pull request, #5176: Add initial support for serializing physical plans with Substrait

andygrove opened a new pull request, #5176:
URL: https://github.com/apache/arrow-datafusion/pull/5176

   # Which issue does this PR close?
   
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
   -->
   
   Part of https://github.com/apache/arrow-datafusion/issues/5173
   
   # Rationale for this change
   
   <!--
    Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
    Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.  
   -->
   
   I would like to be able to use Substrait with physical plans.
   
   # What changes are included in this PR?
   
   <!--
   There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
   -->
   
   - Move existing consumer and producer into `substrait::logical_plan` namespace
   - Create new consumer and producer in `substrait::physical_plan` namespace
   - Implement very basic support for serializing `ParquetExec`
   
   # Are these changes tested?
   
   <!--
   We typically require tests for all PRs in order to:
   1. Prevent the code from being accidentally broken by subsequent changes
   2. Serve as another way to document the expected behavior of the code
   
   If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
   -->
   
   New test added
   
   # Are there any user-facing changes?
   
   <!--
   If there are user-facing changes then we may require documentation to be updated before approving the PR.
   -->
   
   No
   
   <!--
   If there are any breaking changes to public APIs, please add the `api change` label.
   -->


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


[GitHub] [arrow-datafusion] andygrove commented on pull request #5176: Add initial support for serializing physical plans with Substrait

Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove commented on PR #5176:
URL: https://github.com/apache/arrow-datafusion/pull/5176#issuecomment-1418017383

   @nseekhao @jdye64 @waynexia fyi


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


[GitHub] [arrow-datafusion] andygrove merged pull request #5176: Add initial support for serializing physical plans with Substrait

Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove merged PR #5176:
URL: https://github.com/apache/arrow-datafusion/pull/5176


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


[GitHub] [arrow-datafusion] ursabot commented on pull request #5176: Add initial support for serializing physical plans with Substrait

Posted by "ursabot (via GitHub)" <gi...@apache.org>.
ursabot commented on PR #5176:
URL: https://github.com/apache/arrow-datafusion/pull/5176#issuecomment-1420676309

   Benchmark runs are scheduled for baseline = d5077b55ef39e5376ace93d4e9068b94b678e7f1 and contender = de3deb3036d80af3a9030c517e9312323bf10227. de3deb3036d80af3a9030c517e9312323bf10227 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
   Conbench compare runs links:
   [Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on ec2-t3-xlarge-us-east-2] [ec2-t3-xlarge-us-east-2](https://conbench.ursa.dev/compare/runs/9af64835b8314e0080f3d8a008cf7def...4aac09812ad143b59f1b7171a9f51d71/)
   [Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on test-mac-arm] [test-mac-arm](https://conbench.ursa.dev/compare/runs/f3e5d39313f84eca9caf47b26eb3fe1b...3be5151a96af4098a4100ff7d2b53025/)
   [Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on ursa-i9-9960x] [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/a262374b8c124a8aa16dd0141ef14d2a...cc8748708bc2486db06d8d3135c58b5d/)
   [Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on ursa-thinkcentre-m75q] [ursa-thinkcentre-m75q](https://conbench.ursa.dev/compare/runs/2f9a9cf043214f90a23e46ecf10dea52...edd85a7404694eb7a73bac67b09a7360/)
   Buildkite builds:
   Supported benchmarks:
   ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
   test-mac-arm: Supported benchmark langs: C++, Python, R
   ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
   ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java
   


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


[GitHub] [arrow-datafusion] jdye64 commented on a diff in pull request #5176: Add initial support for serializing physical plans with Substrait

Posted by "jdye64 (via GitHub)" <gi...@apache.org>.
jdye64 commented on code in PR #5176:
URL: https://github.com/apache/arrow-datafusion/pull/5176#discussion_r1096721633


##########
datafusion/substrait/src/lib.rs:
##########
@@ -15,8 +15,8 @@
 // specific language governing permissions and limitations
 // under the License.
 
-pub mod consumer;
-pub mod producer;
+pub mod logical_plan;

Review Comment:
   I like these name changes. Make it much more clear what the library is trying to offer.



##########
datafusion/substrait/src/physical_plan/consumer.rs:
##########
@@ -0,0 +1,144 @@
+// 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.
+
+use async_recursion::async_recursion;
+use chrono::DateTime;
+use datafusion::arrow::datatypes::Schema;
+use datafusion::datasource::listing::PartitionedFile;
+use datafusion::datasource::object_store::ObjectStoreUrl;
+use datafusion::error::{DataFusionError, Result};
+use datafusion::physical_plan::file_format::{FileScanConfig, ParquetExec};
+use datafusion::physical_plan::ExecutionPlan;
+use datafusion::prelude::SessionContext;
+use object_store::ObjectMeta;
+use std::collections::HashMap;
+use std::sync::Arc;
+use substrait::proto::read_rel::local_files::file_or_files::PathType;
+use substrait::proto::{
+    expression::MaskExpression, read_rel::ReadType, rel::RelType, Rel,
+};
+
+/// Convert Substrait Rel to DataFusion LogicalPlan

Review Comment:
   Nit, shouldn't this be ExecutionPlan



##########
datafusion/substrait/src/physical_plan/consumer.rs:
##########
@@ -0,0 +1,144 @@
+// 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.
+
+use async_recursion::async_recursion;
+use chrono::DateTime;
+use datafusion::arrow::datatypes::Schema;
+use datafusion::datasource::listing::PartitionedFile;
+use datafusion::datasource::object_store::ObjectStoreUrl;
+use datafusion::error::{DataFusionError, Result};
+use datafusion::physical_plan::file_format::{FileScanConfig, ParquetExec};
+use datafusion::physical_plan::ExecutionPlan;
+use datafusion::prelude::SessionContext;
+use object_store::ObjectMeta;
+use std::collections::HashMap;
+use std::sync::Arc;
+use substrait::proto::read_rel::local_files::file_or_files::PathType;
+use substrait::proto::{
+    expression::MaskExpression, read_rel::ReadType, rel::RelType, Rel,
+};
+
+/// Convert Substrait Rel to DataFusion LogicalPlan
+#[async_recursion]
+pub async fn from_substrait_rel(
+    _ctx: &mut SessionContext,
+    rel: &Rel,
+    _extensions: &HashMap<u32, &String>,
+) -> Result<Arc<dyn ExecutionPlan>> {
+    match &rel.rel_type {
+        Some(RelType::Read(read)) => {
+            if read.filter.is_some() || read.best_effort_filter.is_some() {
+                return Err(DataFusionError::NotImplemented(

Review Comment:
   Is this just because this is a first pass at getting the framework together or is it truly not possible with DataFusion today?



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


[GitHub] [arrow-datafusion] andygrove commented on a diff in pull request #5176: Add initial support for serializing physical plans with Substrait

Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove commented on code in PR #5176:
URL: https://github.com/apache/arrow-datafusion/pull/5176#discussion_r1096931431


##########
datafusion/substrait/src/physical_plan/consumer.rs:
##########
@@ -0,0 +1,144 @@
+// 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.
+
+use async_recursion::async_recursion;
+use chrono::DateTime;
+use datafusion::arrow::datatypes::Schema;
+use datafusion::datasource::listing::PartitionedFile;
+use datafusion::datasource::object_store::ObjectStoreUrl;
+use datafusion::error::{DataFusionError, Result};
+use datafusion::physical_plan::file_format::{FileScanConfig, ParquetExec};
+use datafusion::physical_plan::ExecutionPlan;
+use datafusion::prelude::SessionContext;
+use object_store::ObjectMeta;
+use std::collections::HashMap;
+use std::sync::Arc;
+use substrait::proto::read_rel::local_files::file_or_files::PathType;
+use substrait::proto::{
+    expression::MaskExpression, read_rel::ReadType, rel::RelType, Rel,
+};
+
+/// Convert Substrait Rel to DataFusion LogicalPlan
+#[async_recursion]
+pub async fn from_substrait_rel(
+    _ctx: &mut SessionContext,
+    rel: &Rel,
+    _extensions: &HashMap<u32, &String>,
+) -> Result<Arc<dyn ExecutionPlan>> {
+    match &rel.rel_type {
+        Some(RelType::Read(read)) => {
+            if read.filter.is_some() || read.best_effort_filter.is_some() {
+                return Err(DataFusionError::NotImplemented(

Review Comment:
   Yes, just a first pass. I plan on following up with smaller PRs to make this usable.



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