apache / apache/datafusion

Logical Plan Tree Structure

Open
#13,266 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
9.3k
Forks
2.4k
Avg merge
3d 7h
Merged PRs (30d)
344

Description

### Is your feature request related to a problem or challenge?

Hello guys, I'm interesting in the analysis feature of DataFusion, specifically with the Logical Plan. But it is very frustrating when I can hardly find any documentation on how Logical Plan nodes are built at low level and because Logical Plan nodes have a lot of enums, it is very hard to picture the tree of Logical Plan with just... imagination.

Up until now, we only have sql_analysis.rs as an example of traversing the Logical Plan tree, but still, it only concerns little info of node Join and nothing else, so I have to figure out the rest of tree by a lot of trial - error and also guess-work.

### Describe the solution you'd like

I would love to see (a joint effort maybe) to write a documentation on how Logical Plan tree are built from a query with all possible cases: what is the root of the tree?, which is the leaf?, which node would be push down deeper and why?, etc. The documentation should answer these questions.

Or the best would be an implementation of a print_tree(&LogicalPlan) would be greatly helpful, but again the documentation should the top priority.

### Describe alternatives you've considered

_No response_

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with sql_analysis.rs and inspect how it traverses the Logical Plan, then trace the plan nodes involved in representative queries. Done means documentation explains how Logical Plan trees are built, including roots, leaves, node placement or pushdown, and the possible node cases; the requested print_tree implementation is an alternative rather than a defined requirement.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
databases, documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.