Skip to content

Provide the option of displaying Explain Plans as JSON #6137

Closed as duplicate

Description

@osawyerr

Is your feature request related to a problem or challenge?

Its a feature request - Currently the Explain plan can only be displayed as nested text. In a web based console, its not easy to render this in a user friendly way.

Describe the solution you'd like

It would be great to the option of having the Explain plan shown as a JSON document. If DataFusion is used as a query engine in a product with a web interface, its easier to render an explain plan in a user friendly way if its JSON rather than parsing out the current text format i.e. the JSON can be rendered easier in a browser in any way the app provider wishes.

Describe alternatives you've considered

No response

Additional context

No response

Activity

  1. changed the title [-]Have the option of displaying Explain Plans as JSON[/-] [+]Provide the option of displaying Explain Plans as JSON[/+] on Apr 27, 2023
  2. alamb commented on Apr 27, 2023

    @alamb
    Contributor

    This would be neat -- there is already some way to display plans using the graphviz (dot) format https://docs.rs/datafusion-expr/23.0.0/datafusion_expr/logical_plan/enum.LogicalPlan.html#method.display_graphviz which might get you started

  3. tustvold commented on Apr 28, 2023

    @tustvold
    Contributor

    FWIW a form of this is already supported by datafusion-proto. You can convert the LogicalPlan / ExecutionPlan to the proto representation and then serialize that.

  4. Jefffrey commented on Sep 15, 2025

    @Jefffrey
    Contributor

    Postgres JSON format for explain provided by #15166

  5. alamb commented on Sep 15, 2025

    @alamb
    Contributor

    For example

    > explain format PGJSON select 1;
    +--------------+-----------------------------------------+
    | plan_type    | plan                                    |
    +--------------+-----------------------------------------+
    | logical_plan | [                                       |
    |              |   {                                     |
    |              |     "Plan": {                           |
    |              |       "Expressions": [                  |
    |              |         "Int64(1)"                      |
    |              |       ],                                |
    |              |       "Node Type": "Projection",        |
    |              |       "Output": [                       |
    |              |         "Int64(1)"                      |
    |              |       ],                                |
    |              |       "Plans": [                        |
    |              |         {                               |
    |              |           "Node Type": "EmptyRelation", |
    |              |           "Output": [],                 |
    |              |           "Plans": []                   |
    |              |         }                               |
    |              |       ]                                 |
    |              |     }                                   |
    |              |   }                                     |
    |              | ]                                       |
    +--------------+-----------------------------------------+
    1 row(s) fetched.
    Elapsed 0.019 seconds.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions