apache / apache/datafusion

Eliminate SubqueryAlias

Open
#5,407 5 comments 0 reactions 0 assignees View on GitHub
enhancement help wanted
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? Please describe what you are trying to do.**
Eliminate SubqueryAlias by using a rule.

like Spark have a rule `EliminateSubqueryAlias`.

**Describe the solution you'd like**

**Describe alternatives you've considered**

**Additional context**
spark
``` scala
/**
* Removes [[SubqueryAlias]] operators from the plan. Subqueries are only required to provide
* scoping information for attributes and can be removed once analysis is complete.
*/
object EliminateSubqueryAliases extends Rule[LogicalPlan] {
// This is also called in the beginning of the optimization phase, and as a result
// is using transformUp rather than resolveOperators.
def apply(plan: LogicalPlan): LogicalPlan = AnalysisHelper.allowInvokingTransformsInAnalyzer {
plan.transformUpWithPruning(AlwaysProcess.fn, ruleId) {
case SubqueryAlias(_, child) => child
}
}
}
```

Contributor guide

Open the contributing guide

Research direction

Start by locating the SubqueryAlias logical-plan node and the existing rule infrastructure in DataFusion. Compare the requested behavior with Spark's EliminateSubqueryAliases example and identify where the rule should run. Done means aliases are removed safely after analysis, with relevant plan behavior covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.