Skip to content

Do not print logical plans in tree explain format #15020

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

Closed
Tracked by #14914
alamb opened this issue Mar 5, 2025 · 3 comments · Fixed by #15132
Closed
Tracked by #14914

Do not print logical plans in tree explain format #15020

alamb opened this issue Mar 5, 2025 · 3 comments · Fixed by #15132
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@alamb
Copy link
Contributor

alamb commented Mar 5, 2025

Is your feature request related to a problem or challenge?

We are working on a new user focused explain format

The current explain format has a logical plan and a physical plan. This split is important for people developing DataFusion but not as much for users.

For example, the query like this

set datafusion.explain.format = "tree";

 create table  table1 (
  int_col INT,
  string_col TEXT,
  bigint_col BIGINT,
  date_col DATE
) as VALUES (1, 'foo', 1, '2023-01-01'), (2, 'bar', 2, '2023-01-02'), (3, 'baz', 3, '2023-01-03');
0 row(s) fetched.

explain SELECT int_col FROM table1
WHERE string_col != 'foo' AND string_col != 'bar' AND string_col != 'a really long string constant'

The output looks like this (note the logical_plan line that is very wide)

+---------------+------------------------------------------------------------------------------------------------------------------------------------------------+
| plan_type     | plan                                                                                                                                           |
+---------------+------------------------------------------------------------------------------------------------------------------------------------------------+
| logical_plan  | Projection: table1.int_col                                                                                                                     |
|               |   Filter: table1.string_col != Utf8("foo") AND table1.string_col != Utf8("bar") AND table1.string_col != Utf8("a really long string constant") |
|               |     TableScan: table1 projection=[int_col, string_col]                                                                                         |
| physical_plan | ┌───────────────────────────┐                                                                                                                  |
|               | │    CoalesceBatchesExec    │                                                                                                                  |
|               | └─────────────┬─────────────┘                                                                                                                  |
|               | ┌─────────────┴─────────────┐                                                                                                                  |
|               | │         FilterExec        │                                                                                                                  |
|               | │    --------------------   │                                                                                                                  |
|               | │         predicate:        │                                                                                                                  |
|               | │string_col@1 != foo AND ...│                                                                                                                  |
|               | └─────────────┬─────────────┘                                                                                                                  |
|               | ┌─────────────┴─────────────┐                                                                                                                  |
|               | │       DataSourceExec      │                                                                                                                  |
|               | │    --------------------   │                                                                                                                  |
|               | │    partition_sizes: [1]   │                                                                                                                  |
|               | │       partitions: 1       │                                                                                                                  |
|               | └───────────────────────────┘                                                                                                                  |
|               |                                                                                                                                                |
+---------------+------------------------------------------------------------------------------------------------------------------------------------------------+
2 row(s) fetched.

Describe the solution you'd like

I would like to hide the logical plan in tree mode.

So for the example above, that would look something like

+---------------+---------------------------------------+
| plan_type     | plan                                                                                                                                           |
+---------------+---------------------------------------+
| physical_plan | ┌───────────────────────────┐                                                                                                                  |
|               | │    CoalesceBatchesExec    │                                                                                                                  |
|               | └─────────────┬─────────────┘                                                                                                                  |
|               | ┌─────────────┴─────────────┐                                                                                                                  |
|               | │         FilterExec        │                                                                                                                  |
|               | │    --------------------   │                                                                                                                  |
|               | │         predicate:        │                                                                                                                  |
|               | │string_col@1 != foo AND ...│                                                                                                                  |
|               | └─────────────┬─────────────┘                                                                                                                  |
|               | ┌─────────────┴─────────────┐                                                                                                                  |
|               | │       DataSourceExec      │                                                                                                                  |
|               | │    --------------------   │                                                                                                                  |
|               | │    partition_sizes: [1]   │                                                                                                                  |
|               | │       partitions: 1       │                                                                                                                  |
|               | └───────────────────────────┘                                                                                                                  |
|               |                                                                                                                                                |
+---------------+--------------------------------------+

Describe alternatives you've considered

No response

Additional context

I think this is a fairly straightforward issue and there are existing tests so marking as a good first issue

@alamb alamb added enhancement New feature or request good first issue Good for newcomers labels Mar 5, 2025
@alamb alamb changed the title Avoid printing logical plans in tree explain plans Do not print logical plans in tree explain format Mar 5, 2025
@pgadige
Copy link

pgadige commented Mar 5, 2025

take

@alamb
Copy link
Contributor Author

alamb commented Mar 6, 2025

Thanks @pgadige !

@alamb
Copy link
Contributor Author

alamb commented Mar 10, 2025

I got so excited for this I made a PR here:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants