You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datafusion.apache.org by ag...@apache.org on 2026/08/25 19:14:04 UTC

(datafusion-ballista) branch main updated: chore(core): remove unused diagram module (#2355)

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

andygrove 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 a724ed902 chore(core): remove unused diagram module (#2355)
a724ed902 is described below

commit a724ed9025a19e9f108253579dc7f11bcfb36c93
Author: NoahKusaba <97...@users.noreply.github.com>
AuthorDate: Tue Aug 25 15:13:59 2026 -0400

    chore(core): remove unused diagram module (#2355)
---
 ballista/core/src/diagram.rs | 145 -------------------------------------------
 ballista/core/src/lib.rs     |   2 -
 2 files changed, 147 deletions(-)

diff --git a/ballista/core/src/diagram.rs b/ballista/core/src/diagram.rs
deleted file mode 100644
index 79604e2a1..000000000
--- a/ballista/core/src/diagram.rs
+++ /dev/null
@@ -1,145 +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.
-
-use crate::error::Result;
-use crate::execution_plans::{
-    ShuffleWriter, ShuffleWriterExec, SortShuffleWriterExec, UnresolvedShuffleExec,
-};
-
-use datafusion::datasource::source::DataSourceExec;
-use datafusion::physical_plan::ExecutionPlan;
-use datafusion::physical_plan::aggregates::AggregateExec;
-#[allow(deprecated)]
-use datafusion::physical_plan::coalesce_batches::CoalesceBatchesExec;
-use datafusion::physical_plan::coalesce_partitions::CoalescePartitionsExec;
-use datafusion::physical_plan::filter::FilterExec;
-use datafusion::physical_plan::joins::HashJoinExec;
-use datafusion::physical_plan::projection::ProjectionExec;
-use datafusion::physical_plan::sorts::sort::SortExec;
-use log::warn;
-use std::fs::File;
-use std::io::{BufWriter, Write};
-use std::sync::Arc;
-use std::sync::atomic::{AtomicUsize, Ordering};
-
-/// Produces a Graphviz DOT diagram of the execution stages.
-///
-/// Writes a DOT file to the specified filename that visualizes the relationships
-/// between execution stages and their operators.
-pub fn produce_diagram(filename: &str, stages: &[Arc<dyn ShuffleWriter>]) -> Result<()> {
-    let write_file = File::create(filename)?;
-    let mut w = BufWriter::new(&write_file);
-    writeln!(w, "digraph G {{")?;
-
-    // draw stages and entities
-    for stage in stages {
-        writeln!(w, "\tsubgraph cluster{} {{", stage.stage_id())?;
-        writeln!(w, "\t\tlabel = \"Stage {}\";", stage.stage_id())?;
-        let mut id = AtomicUsize::new(0);
-        build_exec_plan_diagram(
-            &mut w,
-            stage.children()[0].as_ref(),
-            stage.stage_id(),
-            &mut id,
-            true,
-        )?;
-        writeln!(w, "\t}}")?;
-    }
-
-    // draw relationships
-    for stage in stages {
-        let mut id = AtomicUsize::new(0);
-        build_exec_plan_diagram(
-            &mut w,
-            stage.children()[0].as_ref(),
-            stage.stage_id(),
-            &mut id,
-            false,
-        )?;
-    }
-
-    write!(w, "}}")?;
-    Ok(())
-}
-
-#[allow(deprecated)]
-fn build_exec_plan_diagram(
-    w: &mut BufWriter<&File>,
-    plan: &dyn ExecutionPlan,
-    stage_id: usize,
-    id: &mut AtomicUsize,
-    draw_entity: bool,
-) -> Result<usize> {
-    let operator_str = if plan.downcast_ref::<AggregateExec>().is_some() {
-        "AggregateExec"
-    } else if plan.downcast_ref::<SortExec>().is_some() {
-        "SortExec"
-    } else if plan.downcast_ref::<ProjectionExec>().is_some() {
-        "ProjectionExec"
-    } else if plan.downcast_ref::<HashJoinExec>().is_some() {
-        "HashJoinExec"
-    } else if plan.downcast_ref::<DataSourceExec>().is_some() {
-        "DataSourceExec"
-    } else if plan.downcast_ref::<FilterExec>().is_some() {
-        "FilterExec"
-    } else if plan.downcast_ref::<ShuffleWriterExec>().is_some() {
-        "ShuffleWriterExec"
-    } else if plan.downcast_ref::<SortShuffleWriterExec>().is_some() {
-        "SortShuffleWriterExec"
-    } else if plan.downcast_ref::<UnresolvedShuffleExec>().is_some() {
-        "UnresolvedShuffleExec"
-    } else if plan.downcast_ref::<CoalesceBatchesExec>().is_some() {
-        "CoalesceBatchesExec"
-    } else if plan.downcast_ref::<CoalescePartitionsExec>().is_some() {
-        "CoalescePartitionsExec"
-    } else {
-        warn!("Unknown: {plan:?}");
-        "Unknown"
-    };
-
-    let node_id = id.load(Ordering::SeqCst);
-    id.store(node_id + 1, Ordering::SeqCst);
-
-    if draw_entity {
-        writeln!(
-            w,
-            "\t\tstage_{stage_id}_exec_{node_id} [shape=box, label=\"{operator_str}\"];"
-        )?;
-    }
-    for child in plan.children() {
-        if let Some(shuffle) = child.downcast_ref::<UnresolvedShuffleExec>() {
-            if !draw_entity {
-                writeln!(
-                    w,
-                    "\tstage_{}_exec_1 -> stage_{}_exec_{};",
-                    shuffle.stage_id, stage_id, node_id
-                )?;
-            }
-        } else {
-            // relationships within same entity
-            let child_id =
-                build_exec_plan_diagram(w, child.as_ref(), stage_id, id, draw_entity)?;
-            if draw_entity {
-                writeln!(
-                    w,
-                    "\t\tstage_{stage_id}_exec_{child_id} -> stage_{stage_id}_exec_{node_id};"
-                )?;
-            }
-        }
-    }
-    Ok(node_id)
-}
diff --git a/ballista/core/src/lib.rs b/ballista/core/src/lib.rs
index 41bab4a43..e57a2997a 100644
--- a/ballista/core/src/lib.rs
+++ b/ballista/core/src/lib.rs
@@ -68,8 +68,6 @@ pub mod client;
 pub mod client_pool;
 /// Configuration options and settings for Ballista components.
 pub mod config;
-/// Utilities for generating execution plan diagrams.
-pub mod diagram;
 /// Error types and result definitions for Ballista operations.
 pub mod error;
 /// Event loop infrastructure for asynchronous message processing.


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