Various fixes & clean-up around STRUCT UNNEST #11580
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #11578
This PR does a more comprehensive fix of various issues surrounding struct unnest. The issue with struct unnest is that it takes a "special path" since the column expansion happens post-binding. This was previously not handled correctly in a number of places, e.g.
ORDER BY [index]
,ORDER BY ALL
, alias binding, expression maps and set operations. This PR cleans this process up by moving the expansion to a separate structure (SelectBindState
) that has various functions that correctly deal with the extra columns. This cleans up the code and fixes a number of bugs.