Simplify `get_field(named_struct('f', 1), 'f')` => `1`
- Dominant language
- Rust
- Stars
- 9.3k
- Forks
- 2.4k
- Avg merge
- 3d 7h
- Merged PRs (30d)
- 344
Description
We ran into a situation where we ended up with the expression `select get_field(named_struct('f', col, 'f2' other_col), 'f') from original` because it started as a query `select get_field(view_col, 'f') from t_original` where `t` is a view `select named_struct('f', col, 'f2' other_col) as view_col from t_original`.
It would be nice to simplify this away, to `col` in this case.
Contributor guide
Research direction
Start by tracing DataFusion's expression simplification rules for get_field and named_struct, using the example expression in the issue as the reproduction. Confirm the optimizer reduces the nested field access to col while preserving the existing query result, and add or run the relevant optimizer tests if available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, sql
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100