Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix job hangs when partition count of plan is zero #1024

Merged
merged 4 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion ballista/core/src/serde/generated/ballista.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// This file is @generated by prost-build.
/// /////////////////////////////////////////////////////////////////////////////////////////////////
/// Ballista Physical Plan
/// /////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
24 changes: 22 additions & 2 deletions ballista/scheduler/src/state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
// specific language governing permissions and limitations
// under the License.

use datafusion::common::tree_node::{TreeNode, TreeNodeRecursion};
use datafusion::common::tree_node::{Transformed, TreeNode, TreeNodeRecursion};
use datafusion::datasource::listing::{ListingTable, ListingTableUrl};
use datafusion::datasource::source_as_provider;
use datafusion::error::DataFusionError;
use datafusion::physical_plan::ExecutionPlanProperties;
use std::any::type_name;
use std::collections::HashMap;
use std::sync::Arc;
Expand All @@ -39,6 +40,7 @@ use ballista_core::serde::protobuf::TaskStatus;
use ballista_core::serde::BallistaCodec;
use datafusion::logical_expr::LogicalPlan;
use datafusion::physical_plan::display::DisplayableExecutionPlan;
use datafusion::physical_plan::empty::EmptyExec;
use datafusion::prelude::SessionContext;
use datafusion_proto::logical_plan::AsLogicalPlan;
use datafusion_proto::physical_plan::AsExecutionPlan;
Expand Down Expand Up @@ -408,8 +410,26 @@ impl<T: 'static + AsLogicalPlan, U: 'static + AsExecutionPlan> SchedulerState<T,
DisplayableExecutionPlan::new(plan.as_ref()).indent(false)
);

let plan = plan.transform_down(&|node| {
if node.output_partitioning().partition_count() == 0 {
Ok(Transformed::yes(Arc::new(EmptyExec::new(node.schema()))))
} else {
Ok(Transformed::no(node))
}
})?;
debug!(
"Transformed physical plan: {}",
DisplayableExecutionPlan::new(plan.data.as_ref()).indent(false)
);

self.task_manager
.submit_job(job_id, job_name, &session_ctx.session_id(), plan, queued_at)
.submit_job(
job_id,
job_name,
&session_ctx.session_id(),
plan.data,
queued_at,
)
.await?;

let elapsed = start.elapsed();
Expand Down
Loading