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 2021/07/27 18:03:36 UTC
[GitHub] [arrow-datafusion] andygrove opened a new pull request #785: WIP: Tighter integration between DataFusion and Ballista
andygrove opened a new pull request #785:
URL: https://github.com/apache/arrow-datafusion/pull/785
# 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.
-->
Closes #TBD.
# 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.
-->
A DataFrame from a BallistaContext should work just like a DataFrame from a DataFusion ExecutionContext. The user should be able to directly call execution methods such as `collect`.
# 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.
-->
DataFrames created by Ballista have a custom query planner that can create Ballista physical plans.
# Are there any user-facing changes?
<!--
If there are user-facing changes then we may require documentation to be updated before approving the PR.
-->
Yes - the user no longer needs to call `BallistaContext::collect`.
<!--
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] alamb commented on pull request #785: Support DataFrame.collect for Ballista DataFrames
Posted by GitBox <gi...@apache.org>.
alamb commented on pull request #785:
URL: https://github.com/apache/arrow-datafusion/pull/785#issuecomment-887853005
I will plan to review this tomorrow
--
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 #785: Support DataFrame.collect for Ballista DataFrames
Posted by GitBox <gi...@apache.org>.
andygrove merged pull request #785:
URL: https://github.com/apache/arrow-datafusion/pull/785
--
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] alamb commented on a change in pull request #785: Support DataFrame.collect for Ballista DataFrames
Posted by GitBox <gi...@apache.org>.
alamb commented on a change in pull request #785:
URL: https://github.com/apache/arrow-datafusion/pull/785#discussion_r678237456
##########
File path: ballista-examples/src/bin/ballista-dataframe.rs
##########
@@ -38,18 +38,7 @@ async fn main() -> Result<()> {
.select_columns(&["id", "bool_col", "timestamp_col"])?
.filter(col("id").gt(lit(1)))?;
- // execute the query - note that calling collect on the DataFrame
- // trait will execute the query with DataFusion so we have to call
- // collect on the BallistaContext instead and pass it the DataFusion
- // logical plan
- let mut stream = ctx.collect(&df.to_logical_plan()).await?;
-
- // print the results
- let mut results = vec![];
- while let Some(batch) = stream.next().await {
- let batch = batch?;
- results.push(batch);
- }
+ let results = df.collect().await?;
Review comment:
That is certainly nicer 👍
##########
File path: ballista/rust/core/src/execution_plans/distributed_query.rs
##########
@@ -0,0 +1,213 @@
+// 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 std::any::Any;
+use std::convert::TryInto;
+use std::pin::Pin;
+use std::sync::Arc;
+use std::time::Duration;
+
+use crate::client::BallistaClient;
+use crate::config::BallistaConfig;
+use crate::serde::protobuf::{
+ execute_query_params::Query, job_status, scheduler_grpc_client::SchedulerGrpcClient,
+ ExecuteQueryParams, GetJobStatusParams, GetJobStatusResult, KeyValuePair,
+ PartitionLocation,
+};
+use crate::utils::WrappedStream;
+
+use datafusion::arrow::datatypes::{Schema, SchemaRef};
+use datafusion::error::{DataFusionError, Result};
+use datafusion::logical_plan::LogicalPlan;
+use datafusion::physical_plan::{
+ ExecutionPlan, Partitioning, RecordBatchStream, SendableRecordBatchStream,
+};
+
+use async_trait::async_trait;
+use futures::future;
+use futures::StreamExt;
+use log::{error, info};
+
+/// This operator sends a logial plan to a Ballista scheduler for execution and
+/// polls the scheduler until the query is complete and then fetches the resulting
+/// batches directly from the executors that hold the results from the final
+/// query stage.
+#[derive(Debug, Clone)]
+pub struct DistributedQueryExec {
+ /// Ballista scheduler URL
+ scheduler_url: String,
+ /// Ballista configuration
+ config: BallistaConfig,
+ /// Logical plan to execute
+ plan: LogicalPlan,
+}
+
+impl DistributedQueryExec {
+ pub fn new(scheduler_url: String, config: BallistaConfig, plan: LogicalPlan) -> Self {
+ Self {
+ scheduler_url,
+ config,
+ plan,
+ }
+ }
+}
+
+#[async_trait]
+impl ExecutionPlan for DistributedQueryExec {
Review comment:
This is a cool pattern 👍
--
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 #785: Support DataFrame.collect for Ballista DataFrames
Posted by GitBox <gi...@apache.org>.
andygrove commented on pull request #785:
URL: https://github.com/apache/arrow-datafusion/pull/785#issuecomment-888352526
> This is a really nice structure 👍
Thanks. It was nice that I didn't have to make any changes to DataFusion to make this work.
--
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