Skip to content

Implement tree explain for AggregateExec #15024

Closed

Description

@alamb

Is your feature request related to a problem or challenge?

@irenjj added a new tree explain mode in #14677. Now we need to add support for different types of operators.

Here is an example of how to see the new explain plans:

set datafusion.explain.format = 'tree';
create table foo(x int, y int) as values (1,2), (3,4);
explain select * from foo where x = 4;
+---------------+------------------------------------+
| plan_type     | plan                               |
+---------------+------------------------------------+
| logical_plan  | Filter: foo.x = Int32(4)           |
|               |   TableScan: foo projection=[x, y] |
| physical_plan | ┌───────────────────────────┐      |
|               | │    CoalesceBatchesExec    │      |
|               | └─────────────┬─────────────┘      |
|               | ┌─────────────┴─────────────┐      |
|               | │         FilterExec        │      |
|               | └─────────────┬─────────────┘      |
|               | ┌─────────────┴─────────────┐      |
|               | │       DataSourceExec      │      |
|               | │    --------------------   │      |
|               | │    partition_sizes: [1]   │      |
|               | │       partitions: 1       │      |
|               | └───────────────────────────┘      |
|               |                                    |
+---------------+------------------------------------+

Describe the solution you'd like

Add tree format to the ExecutionPlan specified in the subject of this ticket

Note that the tree mode should have only the most relevant information for users to understand what plan is being run. Detailed iformation

The process goes like:

  1. Add the relevant code to the operator
  2. Add / update explain_tree.slt test to show the new code in action

The relevant code looks like this

            DisplayFormatType::TreeRender => {
                // TODO: collect info
                write!(f, "")?;
            }

You can run the tests like

cargo test --test sqllogictests -- explain_tree

You can update the test like this:

cargo test --test sqllogictests -- explain_tree --complete

Describe alternatives you've considered

Here is an example PR that shows what is needed

Additional context

Since this is well specified and has several examples and will give exposure to DataFusion code and testing, I have marked this as a good first issue

Activity

  1. zebsme commented on Mar 5, 2025

    @zebsme
    Contributor

    take

  2. alamb commented on Mar 7, 2025

    @alamb
    ContributorAuthor

    @zebsme how is this going? I noticed you took this and #15025 and #15026

    If you aren't planning on working on them in the near term perhaps you could mention that on the tickets so others who might have time can work on them

  3. zebsme commented on Mar 8, 2025

    @zebsme
    Contributor

    @zebsme how is this going? I noticed you took this and #15025 and #15026

    If you aren't planning on working on them in the near term perhaps you could mention that on the tickets so others who might have time can work on them

    hi,I only took this,15025 and 15026 are not my tickets. And I will work on this tomorrow

  4. alamb commented on Mar 8, 2025

    @alamb
    ContributorAuthor

    @zebsme how is this going? I noticed you took this and #15025 and #15026
    If you aren't planning on working on them in the near term perhaps you could mention that on the tickets so others who might have time can work on them

    hi,I only took this,15025 and 15026 are not my tickets. And I will work on this tomorrow

    Sorry about that -- yes I confused your github handle and @zjregee -- I apologize 🤦

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions