Optimizer adds redundant projections on casts with confusing alias
- Dominant language
- Rust
- Stars
- 9.3k
- Forks
- 2.4k
- Avg merge
- 3d 7h
- Merged PRs (30d)
- 344
Description
**Describe the bug**
https://github.com/apache/arrow-datafusion/pull/3764 fixed one regression but introduced another.
I do not understand why this additional projection is being added.
## Before
```
Inner Join: store_sales.ss_sold_date_sk = date_dim.d_date_sk
```
## After
```
Projection: CAST(date_dim.d_moy AS Int64) AS CAST(date_dim.d_moy AS Int64)date_dim.d_moy, store_sales.ss_customer_sk, date_dim.d_year
Inner Join: store_sales.ss_sold_date_sk = date_dim.d_date_sk
```
**To Reproduce**
No repro available yet
**Expected behavior**
**Additional context**
Contributor guide
Research direction
Start by reviewing Apache DataFusion pull request 3764 and the optimizer behavior that followed it. Reproduce the reported cast and alias plan if possible, then compare the before and after plans in this issue. Done means explaining or removing the redundant projection without changing the join behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- data-engineering
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100