Commit 8a4d073
committed
Generate unique LATERAL FLATTEN aliases per query
Replace the hardcoded FLATTEN_DEFAULT_ALIAS ("_unnest") with a
per-SelectBuilder counter that generates unique aliases (_unnest_1,
_unnest_2, …). This prevents alias collisions when multiple unnests
appear in the same query.
- Add flatten_alias_counter to SelectBuilder with next/current
accessor methods, scoped to one SELECT so subqueries get
independent counters
- Remove FLATTEN_DEFAULT_ALIAS constant, the dead alias_name()
method, and the default alias from FlattenRelationBuilder
- All three FLATTEN code paths (placeholder projection, display-name
projection, and Unnest handler) now coordinate through the
SelectBuilder to ensure SELECT items and FROM clause use the same
alias
- Use internal_datafusion_err! macro for FLATTEN error handling
- Migrate unnest tests from partial .contains() assertions to
insta::assert_snapshot! for full SQL verification1 parent 5f1d805 commit 8a4d073
4 files changed
Lines changed: 326 additions & 186 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
165 | 170 | | |
166 | 171 | | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
167 | 175 | | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
168 | 211 | | |
169 | 212 | | |
170 | 213 | | |
| |||
371 | 414 | | |
372 | 415 | | |
373 | 416 | | |
| 417 | + | |
| 418 | + | |
374 | 419 | | |
375 | 420 | | |
376 | 421 | | |
| |||
697 | 742 | | |
698 | 743 | | |
699 | 744 | | |
700 | | - | |
701 | | - | |
702 | | - | |
703 | | - | |
704 | 745 | | |
705 | 746 | | |
706 | 747 | | |
| |||
757 | 798 | | |
758 | 799 | | |
759 | 800 | | |
760 | | - | |
761 | | - | |
762 | | - | |
763 | | - | |
764 | | - | |
765 | | - | |
766 | | - | |
767 | | - | |
768 | | - | |
769 | 801 | | |
770 | 802 | | |
771 | | - | |
772 | | - | |
773 | | - | |
774 | | - | |
775 | | - | |
| 803 | + | |
776 | 804 | | |
777 | 805 | | |
778 | 806 | | |
| |||
0 commit comments