Improve `EXPLAN` command support
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
EXPLAN query provides valuable information to understand job behaviour, at the moment it will provide datafusion plan without shuffles, also it does not really provide information for EXPLAN ANALYSE
Describe the solution you'd like
Improve EXPLAN command support
Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.
Additional context Add any other context or screenshots about the feature request here.
Hey team, I’m new to the DataFusion/Ballista community and would love to start contributing from this issue 🙂
Welcome, let us know if you need any help
Hey @milenkovicm , I read through the codebase and have an initial proposal for EXPLAIN (I will start work on EXPLAIN first, then EXPLAN ANALYZE)
- In Ballista's scheduler phase (when logical → physical), detect the
ExecExplain(DF one) node, replace with new customBallistaExecPlannode - Implement
BallistaExecPlanreturns three rows:
- Logical plan: reuse DF’s final logical plan from ExplainExec.
- physical plan: reuse DF’s final physical plan from ExplainExec
- distributed plan: derive from Ballista’s stage DAG (DefaultDistributedPlanner::plan_query_stages), showing stages/shuffles/deps.
PS: Why a new exec instead of reusing ExplainExec? DF’s ExplainExec filters rows via PlanType::should_display(). In non-VERBOSE mode it only shows logical_plan and physical_plan. Our distributed_plan is unknown to DF’s PlanType, so: • Plan A: either we “fake” it as another physical_plan row (but potentially confusing to user), or • Plan B: we introduce a Ballista-specific exec that appends a third distributed_plan row explicitly.
Happy to know your thought here, is the solution sounds good to you, and do you prefer plan A or B in this case?
Your plan makes sense @danielhumanmod, If it is easier we could split this issue in two, explain and explain analyse and deliver it as two separate PRs.
Regarding options, B looks better to me but once you start implementing you'll have better idea.
Hey @milenkovicm , I have finished the draft version for EXPLAIN implementation #1309 and would love to get some early feedbacks from you :)