You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datafusion.apache.org by mi...@apache.org on 2026/06/02 17:22:15 UTC

(datafusion-ballista) branch main updated: minor: code/log cleanup (#1805)

This is an automated email from the ASF dual-hosted git repository.

milenkovicm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion-ballista.git


The following commit(s) were added to refs/heads/main by this push:
     new 759344345 minor: code/log cleanup (#1805)
759344345 is described below

commit 7593443450e943af99a54941361f34747297ea28
Author: Marko Milenković <mi...@users.noreply.github.com>
AuthorDate: Tue Jun 2 18:22:10 2026 +0100

    minor: code/log cleanup (#1805)
---
 README.md                                          |  2 +-
 .../core/src/execution_plans/shuffle_writer.rs     |  4 +-
 ballista/executor/src/execution_loop.rs            |  4 +-
 ballista/executor/src/executor_server.rs           | 14 +++--
 ballista/executor/src/lib.rs                       |  3 +-
 ballista/executor/src/metrics/mod.rs               |  4 +-
 ballista/scheduler/Cargo.toml                      |  2 +-
 ballista/scheduler/src/display.rs                  |  4 +-
 .../src/scheduler_server/query_stage_scheduler.rs  |  4 +-
 ballista/scheduler/src/state/aqe/mod.rs            |  2 +-
 .../state/aqe/optimizer_rule/datafusion_patch.rs   | 72 ----------------------
 .../scheduler/src/state/aqe/optimizer_rule/mod.rs  |  2 -
 ballista/scheduler/src/state/aqe/planner.rs        | 10 +--
 ballista/scheduler/src/state/execution_graph.rs    |  2 +-
 ballista/scheduler/src/state/task_manager.rs       |  8 ++-
 15 files changed, 31 insertions(+), 106 deletions(-)

diff --git a/README.md b/README.md
index 2ea2a3efb..b95dd5256 100644
--- a/README.md
+++ b/README.md
@@ -156,7 +156,7 @@ Ballista uses Cargo features to enable optional functionality. Below are the ava
 | Feature                    | Default | Description                                      |
 | -------------------------- | ------- | ------------------------------------------------ |
 | `build-binary`             | Yes     | Builds the scheduler binary with CLI and logging |
-| `substrait`                | Yes     | Enables Substrait plan support                   |
+| `substrait`                | No      | Enables Substrait plan support                   |
 | `prometheus-metrics`       | No      | Enables Prometheus metrics collection            |
 | `graphviz-support`         | No      | Enables execution graph visualization            |
 | `spark-compat`             | No      | Enables Spark compatibility mode                 |
diff --git a/ballista/core/src/execution_plans/shuffle_writer.rs b/ballista/core/src/execution_plans/shuffle_writer.rs
index a852b91fc..cdb1a16cd 100644
--- a/ballista/core/src/execution_plans/shuffle_writer.rs
+++ b/ballista/core/src/execution_plans/shuffle_writer.rs
@@ -63,7 +63,7 @@ use datafusion::arrow::error::ArrowError;
 use datafusion::execution::context::TaskContext;
 use datafusion::physical_plan::repartition::BatchPartitioner;
 use datafusion::physical_plan::stream::RecordBatchStreamAdapter;
-use log::{debug, error, info};
+use log::{debug, error};
 
 use super::shuffle_writer_trait::ShuffleWriter;
 
@@ -250,7 +250,7 @@ impl ShuffleWriterExec {
                         .output_rows
                         .add(stats.num_rows.unwrap_or(0) as usize);
 
-                    info!(
+                    debug!(
                         "Executed partition {} in {} seconds. Statistics: {}",
                         input_partition,
                         now.elapsed().as_secs(),
diff --git a/ballista/executor/src/execution_loop.rs b/ballista/executor/src/execution_loop.rs
index 6cc8c1192..c1683d54f 100644
--- a/ballista/executor/src/execution_loop.rs
+++ b/ballista/executor/src/execution_loop.rs
@@ -307,8 +307,8 @@ async fn run_received_task<T: 'static + AsLogicalPlan, U: 'static + AsExecutionP
             }
         };
 
-        info!("Done with task {task_identity}");
-        debug!("Statistics: {execution_result:?}");
+        info!("Finished task : [{task_identity}]");
+        debug!("Task statistics: [{task_identity}] {execution_result:?}");
 
         let plan_metrics = query_stage_exec.collect_plan_metrics();
         let operator_metrics = plan_metrics
diff --git a/ballista/executor/src/executor_server.rs b/ballista/executor/src/executor_server.rs
index c87c1322b..c52998ad5 100644
--- a/ballista/executor/src/executor_server.rs
+++ b/ballista/executor/src/executor_server.rs
@@ -361,7 +361,7 @@ impl<T: 'static + AsLogicalPlan, U: 'static + AsExecutionPlan> ExecutorServer<T,
             .duration_since(UNIX_EPOCH)
             .unwrap()
             .as_millis() as u64;
-        info!("Start to run task {task_identity}");
+        debug!("Start to run task {task_identity}");
         let task = curator_task.task;
 
         let task_id = task.task_id;
@@ -404,7 +404,7 @@ impl<T: 'static + AsLogicalPlan, U: 'static + AsExecutionPlan> ExecutorServer<T,
                     ))
                 };
 
-                info!("Execute task: {task_identity}");
+                info!("Execute task  : [{task_identity}]");
 
                 let execution_result = self
                     .executor
@@ -415,8 +415,10 @@ impl<T: 'static + AsLogicalPlan, U: 'static + AsExecutionPlan> ExecutorServer<T,
                         task_context,
                     )
                     .await;
-                info!("Done with task {task_identity}");
-                debug!("Task {task_identity} statistics: {execution_result:?}");
+                info!("Finished task : [{task_identity}]");
+                debug!(
+                    "Task [{task_identity}], execution statistics: {execution_result:?}"
+                );
 
                 let plan_metrics = exec.collect_plan_metrics();
                 let operator_metrics = plan_metrics
@@ -706,7 +708,7 @@ impl<T: 'static + AsLogicalPlan, U: 'static + AsExecutionPlan> TaskRunnerPool<T,
                             fetched_task_num += 1;
                         }
                         Err(TryRecvError::Empty) => {
-                            info!("Fetched {fetched_task_num} tasks status to report");
+                            debug!("Fetched {fetched_task_num} tasks status to report");
                             break;
                         }
                         Err(TryRecvError::Disconnected) => {
@@ -782,7 +784,7 @@ impl<T: 'static + AsLogicalPlan, U: 'static + AsExecutionPlan> TaskRunnerPool<T,
                         &curator_task.task.partition_id,
                         &curator_task.task.task_attempt_num,
                     );
-                    info!("Received task {:?}", &task_identity);
+                    debug!("Received task {:?}", &task_identity);
 
                     let server = executor_server.clone();
                     dedicated_executor.spawn(async move {
diff --git a/ballista/executor/src/lib.rs b/ballista/executor/src/lib.rs
index 3db736e01..4aeae7710 100644
--- a/ballista/executor/src/lib.rs
+++ b/ballista/executor/src/lib.rs
@@ -48,6 +48,7 @@ mod cpu_bound_executor;
 mod standalone;
 
 use ballista_core::error::BallistaError;
+use log::debug;
 use std::net::SocketAddr;
 
 pub use standalone::new_standalone_executor;
@@ -110,7 +111,7 @@ pub fn as_task_status(
     let metrics = operator_metrics.unwrap_or_default();
     match execution_result {
         Ok(partitions) => {
-            info!(
+            debug!(
                 "Task {:?} finished with operator_metrics array size {}",
                 task_id,
                 metrics.len()
diff --git a/ballista/executor/src/metrics/mod.rs b/ballista/executor/src/metrics/mod.rs
index 7f6878a81..b80f75adc 100644
--- a/ballista/executor/src/metrics/mod.rs
+++ b/ballista/executor/src/metrics/mod.rs
@@ -16,7 +16,7 @@
 // under the License.
 
 use crate::execution_engine::QueryStageExecutor;
-use log::info;
+use log::debug;
 use std::{fmt::Display, sync::Arc};
 
 /// `ExecutorMetricsCollector` records metrics for `ShuffleWriteExec`
@@ -48,7 +48,7 @@ impl ExecutorMetricsCollector for LoggingMetricsCollector {
         partition: usize,
         plan: Arc<dyn QueryStageExecutor>,
     ) {
-        info!(
+        debug!(
             "\n=== [{job_id}/{stage_id}/{partition}] Physical plan with metrics ===\n{plan}\n"
         );
     }
diff --git a/ballista/scheduler/Cargo.toml b/ballista/scheduler/Cargo.toml
index 9dab576ee..cb60881fb 100644
--- a/ballista/scheduler/Cargo.toml
+++ b/ballista/scheduler/Cargo.toml
@@ -34,7 +34,7 @@ required-features = ["build-binary"]
 
 [features]
 build-binary = ["clap", "tracing-subscriber", "tracing-appender", "tracing", "ballista-core/build-binary"]
-default = ["build-binary", "substrait", "rest-api"]
+default = ["build-binary", "rest-api"]
 # job info can cache stage plans, in some cases where
 # task plans can be re-computed, cache behavior may need to be disabled.
 disable-stage-plan-cache = []
diff --git a/ballista/scheduler/src/display.rs b/ballista/scheduler/src/display.rs
index f29f9e6dd..fb47f42a9 100644
--- a/ballista/scheduler/src/display.rs
+++ b/ballista/scheduler/src/display.rs
@@ -25,7 +25,7 @@ use datafusion::physical_plan::metrics::MetricsSet;
 use datafusion::physical_plan::{
     DisplayFormatType, ExecutionPlan, ExecutionPlanVisitor, accept, displayable,
 };
-use log::{error, info};
+use log::{debug, error};
 use std::fmt;
 
 /// Merges executor-collected stage metrics into the plan's metric slots.
@@ -59,7 +59,7 @@ pub fn print_stage_metrics(
     // The plan_metrics collected here is a snapshot clone from the plan metrics.
     // They are all empty now and need to combine with the stage metrics in the ExecutionStages
     match merge_stage_metrics(plan, stage_metrics) {
-        Some(plan_metrics) => info!(
+        Some(plan_metrics) => debug!(
             "\n=== [{}/{}] Stage finished, physical plan with metrics ===\n{}",
             job_id,
             stage_id,
diff --git a/ballista/scheduler/src/scheduler_server/query_stage_scheduler.rs b/ballista/scheduler/src/scheduler_server/query_stage_scheduler.rs
index 85b0924e2..db85deaed 100644
--- a/ballista/scheduler/src/scheduler_server/query_stage_scheduler.rs
+++ b/ballista/scheduler/src/scheduler_server/query_stage_scheduler.rs
@@ -174,7 +174,7 @@ impl<T: 'static + AsLogicalPlan, U: 'static + AsExecutionPlan>
                 self.metrics_collector
                     .record_submitted(&job_id, queued_at, submitted_at);
 
-                info!("Job {job_id} submitted");
+                info!("Job submitted: [{job_id}]");
 
                 if self.state.config.is_push_staged_scheduling() {
                     event_sender
@@ -211,7 +211,7 @@ impl<T: 'static + AsLogicalPlan, U: 'static + AsExecutionPlan>
                 self.metrics_collector
                     .record_completed(&job_id, queued_at, completed_at);
 
-                info!("Job {job_id} success");
+                info!("Job finished successfully: [{job_id}]");
                 if let Err(e) = self.state.task_manager.succeed_job(&job_id).await {
                     error!("Fail to invoke succeed_job for job {job_id} due to {e:?}");
                 }
diff --git a/ballista/scheduler/src/state/aqe/mod.rs b/ballista/scheduler/src/state/aqe/mod.rs
index 3470379cc..f069714e6 100644
--- a/ballista/scheduler/src/state/aqe/mod.rs
+++ b/ballista/scheduler/src/state/aqe/mod.rs
@@ -279,7 +279,7 @@ impl AdaptiveExecutionGraph {
             });
         } else if self.is_successful() {
             // If this ExecutionGraph is successful, finish it
-            info!("Job {job_id} is success, finalizing output partitions");
+            debug!("Job {job_id} is success, finalizing output partitions ...");
             self.succeed_job()?;
             events.push(QueryStageSchedulerEvent::JobFinished {
                 job_id,
diff --git a/ballista/scheduler/src/state/aqe/optimizer_rule/datafusion_patch.rs b/ballista/scheduler/src/state/aqe/optimizer_rule/datafusion_patch.rs
deleted file mode 100644
index 01fde07c0..000000000
--- a/ballista/scheduler/src/state/aqe/optimizer_rule/datafusion_patch.rs
+++ /dev/null
@@ -1,72 +0,0 @@
-// 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.
-
-//! Some datafusion rules are not idempotent, thus set of
-//! physical plan rules needed to fix them.
-//!
-//! Datafusion needs to be patched, until then
-//! we keep the rules.
-use datafusion::common::tree_node::{Transformed, TransformedResult, TreeNode};
-use datafusion::config::ConfigOptions;
-use datafusion::physical_optimizer::PhysicalOptimizerRule;
-use datafusion::physical_plan::{ExecutionPlan, displayable};
-use log::warn;
-use std::sync::Arc;
-
-/// This rule is just for DEBUG purposes as some
-/// physical rules are not idempotent.
-#[derive(Debug, Clone, Default)]
-pub struct WarnOnDuplicateExecRule {}
-
-impl WarnOnDuplicateExecRule {
-    fn transform(
-        execution_plan: Arc<dyn ExecutionPlan>,
-    ) -> datafusion::error::Result<Transformed<Arc<dyn ExecutionPlan>>> {
-        let exec_name = execution_plan.name();
-        if execution_plan
-            .children()
-            .iter()
-            .any(|child| child.name() == exec_name)
-        {
-            warn!(
-                "there might be a duplicated exec with name {},\n {}",
-                exec_name,
-                displayable(execution_plan.as_ref()).indent(false)
-            );
-        }
-
-        Ok(Transformed::no(execution_plan))
-    }
-}
-
-impl PhysicalOptimizerRule for WarnOnDuplicateExecRule {
-    fn optimize(
-        &self,
-        plan: Arc<dyn ExecutionPlan>,
-        _: &ConfigOptions,
-    ) -> datafusion::common::Result<Arc<dyn ExecutionPlan>> {
-        plan.transform_down(Self::transform).data()
-    }
-
-    fn name(&self) -> &str {
-        "WarnOnDuplicateExecRule"
-    }
-
-    fn schema_check(&self) -> bool {
-        false
-    }
-}
diff --git a/ballista/scheduler/src/state/aqe/optimizer_rule/mod.rs b/ballista/scheduler/src/state/aqe/optimizer_rule/mod.rs
index 34f718745..5838694c3 100644
--- a/ballista/scheduler/src/state/aqe/optimizer_rule/mod.rs
+++ b/ballista/scheduler/src/state/aqe/optimizer_rule/mod.rs
@@ -16,13 +16,11 @@
 // under the License.
 
 pub mod coalesce_partitions;
-pub mod datafusion_patch;
 pub mod distributed_exchange;
 pub mod join_selection;
 pub mod propagate_empty;
 
 pub use coalesce_partitions::*;
-pub use datafusion_patch::*;
 pub use distributed_exchange::*;
 pub use join_selection::*;
 pub use propagate_empty::*;
diff --git a/ballista/scheduler/src/state/aqe/planner.rs b/ballista/scheduler/src/state/aqe/planner.rs
index 3c50338e9..298d77c34 100644
--- a/ballista/scheduler/src/state/aqe/planner.rs
+++ b/ballista/scheduler/src/state/aqe/planner.rs
@@ -18,7 +18,7 @@ use crate::state::aqe::adapter::BallistaAdapter;
 use crate::state::aqe::execution_plan::{AdaptiveDatafusionExec, ExchangeExec};
 use crate::state::aqe::optimizer_rule::{
     CoalescePartitionsRule, DelayJoinSelectionRule, DistributedExchangeRule,
-    PropagateEmptyExecRule, SelectJoinRule, WarnOnDuplicateExecRule,
+    PropagateEmptyExecRule, SelectJoinRule,
 };
 
 use crate::state::distributed_explain::handle_explain_plan;
@@ -499,14 +499,6 @@ impl AdaptivePlanner {
         // `DistributedExchangeRule` should be the last plan mutator rule in the chain
         physical_optimizers
             .push(Arc::new(DistributedExchangeRule::new(plan_id_generator)));
-        // we should remove it at the later stage this is just temporary
-        // to detect possible duplicate execs.
-        // rule does not mutate plan hance it can go after `DistributedExchangeRule`
-        physical_optimizers.push(Arc::new(WarnOnDuplicateExecRule::default()));
-
-        // `CoalescePartitionsRule` is invoked per-stage in `actionable_stages()`
-        // rather than registered here, so each invocation sees only one stage's
-        // plan and forms an alignment group scoped to that stage's inputs.
 
         physical_optimizers
     }
diff --git a/ballista/scheduler/src/state/execution_graph.rs b/ballista/scheduler/src/state/execution_graph.rs
index dac3bed21..97e421756 100644
--- a/ballista/scheduler/src/state/execution_graph.rs
+++ b/ballista/scheduler/src/state/execution_graph.rs
@@ -410,7 +410,7 @@ impl StaticExecutionGraph {
             });
         } else if self.is_successful() {
             // If this ExecutionGraph is successful, finish it
-            info!("Job {job_id} is success, finalizing output partitions");
+            debug!("Job {job_id} is success, finalizing job output ...");
             self.succeed_job()?;
             events.push(QueryStageSchedulerEvent::JobFinished {
                 job_id,
diff --git a/ballista/scheduler/src/state/task_manager.rs b/ballista/scheduler/src/state/task_manager.rs
index 082419dae..73776b90b 100644
--- a/ballista/scheduler/src/state/task_manager.rs
+++ b/ballista/scheduler/src/state/task_manager.rs
@@ -98,7 +98,7 @@ impl TaskLauncher for DefaultTaskLauncher {
                     format!("{}/{}/{:?}", task.job_id, task.stage_id, task_ids)
                 })
                 .collect();
-            info!(
+            debug!(
                 "Launching multi task on executor {:?} for {:?}",
                 executor.id, tasks_ids
             );
@@ -320,8 +320,12 @@ impl<T: 'static + AsLogicalPlan, U: 'static + AsExecutionPlan> TaskManager<T, U>
                 Some(logical_plan.display_indent().to_string()),
             )?) as ExecutionGraphBox
         };
+        let string_plan =
+            datafusion::physical_plan::displayable(graph.physical_plan().as_ref())
+                .indent(false)
+                .to_string();
 
-        info!("Submitting execution graph:\n\n{graph:?}");
+        info!("Submitting execution graph for job_id: {job_id}:\n\n{string_plan}");
 
         self.state
             .submit_job(job_id.to_string(), &graph, subscriber)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For additional commands, e-mail: commits-help@datafusion.apache.org