Skip to content

EXPLAIN VERBOSE only works when format is set to (non-default) 'indent' #17480

Closed

Description

@petern48

Describe the bug

On the datafusion-cli, tree was made the default explain format in this PR. Now, when we use EXPLAIN VERBOSE, we simply get the regular output of explain format tree, which isn't verbose.

To Reproduce

cd datafusion-cli
cargo run

> explain verbose select max(1 + 3);
+---------------+-------------------------------+
| plan_type     | plan                          |
+---------------+-------------------------------+
| physical_plan | ┌───────────────────────────┐ |
|               | │       AggregateExec       │ |
|               | │    --------------------   │ |
|               | │           aggr:           │ |
|               | │  max(Int64(1) + Int64(3)) │ |
|               | │                           │ |
|               | │        mode: Single       │ |
|               | └─────────────┬─────────────┘ |
|               | ┌─────────────┴─────────────┐ |
|               | │     PlaceholderRowExec    │ |
|               | └───────────────────────────┘ |
|               |                               |
+---------------+-------------------------------+

To workaround this, the user has to manually set the format option to indent to get the desired verbose explain output

set datafusion.explain.format = 'indent';
> explain verbose select max(1 + 3);

Expected behavior

Since only indent is supported for explain verbose, I think it would be nice to just override the explain format to indent when verbose is specified.

+------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------+
| plan_type                                                  | plan                                                                                                                          |
+------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------+
| initial_logical_plan                                       | Projection: max(Int64(1) + Int64(3))                                                                                          |
|                                                            |   Aggregate: groupBy=[[]], aggr=[[max(Int64(1) + Int64(3))]]                                                                  |
|                                                            |     EmptyRelation: rows=1                                                                                                     |
| logical_plan after resolve_grouping_function               | SAME TEXT AS ABOVE                                                                                                            |
| logical_plan after type_coercion                           | SAME TEXT AS ABOVE
| analyzed_logical_plan                                      | SAME TEXT AS ABOVE                                                                                                            |
| logical_plan after eliminate_nested_union                  | SAME TEXT AS ABOVE                                                                                                            |
| logical_plan after simplify_expressions                    | Projection: max(Int64(1) + Int64(3))
...

Additional context

No response

Activity

  1. petern48 commented on Sep 9, 2025

    @petern48
    MemberAuthor

    take

  2. 2010YOUY01 commented on Sep 9, 2025

    @2010YOUY01
    Contributor

    Good idea! Perhaps we can override EXPLAIN ANALYZE too?

  3. petern48 commented on Sep 9, 2025

    @petern48
    MemberAuthor

    Good idea! Perhaps we can override EXPLAIN ANALYZE too?

    That's a good idea, too! I tried it in the cli, and explain analyze already overrides to indent. The code is a little different, so it happens naturally, whereas we need to override it explicitly for explain verbose.

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions