Skip to content

[multistage]: Support different output formats(XML, JSON, DOT and TEXT) for explain physical plan #11039

@abhioncbr

Description

@abhioncbr

Problem
Currently, ExplainPlanPlanVisitor.explain (code reference) provides the physical plan of the SQL query in a simple text format. One such example of the output is as follows.

 [0]@localhost:3 MAIL_RECEIVE(RANDOM_DISTRIBUTED)
├── [1]@localhost:2 MAIL_SEND(RANDOM_DISTRIBUTED)->{[0]@localhost@{3,3}|[0]}
│   └── [1]@localhost:2 PROJECT
│      └── [1]@localhost:2 TABLE SCAN (a) null
└── [1]@localhost:1 MAIL_SEND(RANDOM_DISTRIBUTED)->{[0]@localhost@{3,3}|[0]}
   └── [1]@localhost:1 PROJECT
      └── [1]@localhost:1 TABLE SCAN (a) null

EXPLAIN PLAN FOR SQL query supports various formats(XML, JSON, DOT and TEXT), and with the solution approach to the issue(support explain on physical plan ); the output of the physical plan of the query should follow the same format as mentioned in the Explain Query.

Solution Approach

  • Extend the ExplainPlanPlanVisitor class for different output formats and generate the physical plan based on the format mentioned in the Explain query.
  • TEXT will be the default output format, if not mentioned in the Explain query.

NOTE
example of the Explain query with format option

EXPLAIN Plan As JSON Select * from airlineStats

labels:

  • enhancement

cc: @walterddr

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions