apache / apache/datafusion

[DISCUSS] keeping `LogicalPlan::transform_with_subqueries` et al

Open
#10,011 2 comments 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?

One thing I finally understand while writing this is why @peter-toth added `transform_down_mut_with_subqueries` and similar functions. It is to mirror what is available on `TreeNode` (e.g. [`transform_down_mut`](https://docs.rs/datafusion/latest/datafusion/common/tree_node/trait.TreeNode.html#method.transform_down_mut))

![Screenshot 2024-04-09 at 7 36 34 AM](https://github.com/apache/arrow-datafusion/assets/490673/5c42aa58-db5b-49e8-8850-0511fe6ee4fc)

While these functions have a nice symmetry I think their presence is more confusing than helpful and their use is quite limited (as can be seen by their implementation https://github.com/apache/arrow-datafusion/blob/eb05741e2167dec5df10a10c8435ebedbea6787d/datafusion/expr/src/logical_plan/plan.rs#L1392-L1445)

I clearly was confused as well myself in the past when I tried to remove them: https://github.com/apache/arrow-datafusion/pull/9997

### Describe the solution you'd like

I think we should remove these functions in the name of a cleaner API

### Describe alternatives you've considered

We can leave them

### Additional context

I only finally realized what was going on while trying to document these functions: https://github.com/apache/arrow-datafusion/pull/10010

Contributor guide

Open the contributing guide

Research direction

Start in datafusion/expr/src/logical_plan/plan.rs, around the transform_with_subqueries and transform_down_mut_with_subqueries implementations, and read the linked PR context about documenting them. Search the repository for uses of these functions and determine the required cleanup. Done means the functions and their references are removed without breaking the logical-plan API or its tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
databases
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.