Skip to content

Support dot graph output in explain (analyze) #3606

Open

Description

@Dandandan

Is your feature request related to a problem or challenge? Please describe what you are trying to do.
We support converting a logical plan to a dot language graph (.dot) - I believe Ballista also supports it (by @andygrove ?) It would be great to support this as format for explain analyze

Describe the solution you'd like
Return the .dot graph output when giving the FORMAT DOT as option to explain / explain analyze statements. Amazon Athena has a similar feature: https://docs.aws.amazon.com/athena/latest/ug/athena-explain-statement.html

Describe alternatives you've considered

Additional context

Activity

  1. changed the title [-]Support dot graph in explain (analyze)[/-] [+]Support dot graph output in explain (analyze)[/+] on Sep 24, 2022
  2. alamb commented on Sep 25, 2022

    @alamb
    Contributor

    There is already a code to make graphviz format here: https://github.com/apache/arrow-datafusion/blob/81b57948778cfa485d8b3f2c1fe4485f3966e8e4/datafusion/expr/src/logical_plan/plan.rs#L604-L633

    It might be kind of old / out of date, so might need to be updated

    Perhaps we could add some new configuration option like "show_graphviz_during_explain" whihc if true would also output the graphviz output?

  3. Dandandan commented on Sep 25, 2022

    @Dandandan
    ContributorAuthor

    My plan is to use the presto syntax

    EXPLAIN [ANALYZE] [FORMAT GRAPHVIZ|JSON|TEXT]

    to control the output, which should default to TEXT (current output).

  4. Dandandan commented on Sep 25, 2022

    @Dandandan
    ContributorAuthor

    Added a PR for the syntax in here apache/datafusion-sqlparser-rs#621

  5. andygrove commented on Sep 26, 2022

    @andygrove
    Member

    @Dandandan Since you asked, I have a PR open against Ballista related to DOT graphs - apache/datafusion-ballista#242. Feel free to review if you like. I would love to get this merged soon.

  6. alamb commented on Sep 27, 2022

    @alamb
    Contributor

    I'll try and get a sqlparser-rs release out in the next day or two

  7. mkmik commented on Sep 27, 2022

    @mkmik
    Contributor

    There are many visualizers that can process the postgres explain JSON format (e.g. https://github.com/dalibo/pev2 or https://github.com/mgartner/pg_flame)

  8. alamb commented on Sep 28, 2022

    @alamb
    Contributor
  9. liurenjie1024 commented on May 25, 2023

    @liurenjie1024
    Contributor

    Hi, @Dandandan are you still working on this?

  10. liurenjie1024 commented on Jun 13, 2023

    @liurenjie1024
    Contributor

    @alamb Seems @Dandandan not responding, I will go on with this issue, please assign it to me.

  11. alamb commented on Jun 13, 2023

    @alamb
    Contributor
  12. Dandandan commented on Jun 13, 2023

    @Dandandan
    ContributorAuthor

    Hey @liurenjie1024 , yes feel free to work on it. Thank you @liurenjie1024

  13. 16pierre commented on Apr 24, 2025

    @16pierre

    Related but not 100% same topic as original issue - happy to take the conversation elsewhere if you prefer:

    I'm interested in Dalibo visualizations because the UI is quite powerful. Unless I'm mistaken display_pg_json introduced in #9789 only applies to LogicalPlan and cannot be leveraged for execution plans and execution metrics.

    Is there any plan on adding more physical plan display implementations, for example the ExecutionPlan equivalent of display_pg_json / would you be open to contributions on this end ?

  14. alamb commented on Apr 28, 2025

    @alamb
    Contributor

    We have made the explain formats available via SQL now in DataFusion 47. See docs here: https://datafusion.apache.org/user-guide/sql/explain.html#id1

    Is there any plan on adding more physical plan display implementations, for example the ExecutionPlan equivalent of display_pg_json / would you be open to contributions on this end ?

    There is no plan that I know of. From my point of view, this seems like a good addition as long as it doesn't add (very much) additional overhead / API churn

    THanks @16pierre

  15. tomsanbear commented on Oct 29, 2025

    @tomsanbear
    Contributor

    test

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

Metadata

Metadata

Assignees

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