Skip to content

optimizer: propagate sort keys through ValuesOp - #7559

Merged
mattnibs merged 1 commit into
mainfrom
values-sort-keys
Oct 30, 2026
Merged

mattnibs merged 1 commit into
mainfrom
values-sort-keys

Conversation

@mattnibs

Copy link
Copy Markdown
Collaborator

analyzeSortKeys had no case for ValuesOp, so any values operator made the sort order unknown even when it passed the sort key through unchanged. This blocked lifting values (and everything downstream of it) into parallel paths ahead of a merge, e.g., the values operator generated by every SQL SELECT.

A values operator with a single record expression without spreads is now flattened into the equivalent cut assignments and analyzed the same way as cut (analyzeCuts is renamed analyzeAssignments to reflect this). ValuesOp is also added to the set of operators liftIntoParPaths may copy into parallel paths.

@mattnibs
mattnibs requested a review from a team October 29, 2026 21:16
@mattnibs
mattnibs added this pull request to stack #7561 October 29, 2026 21:32
Comment thread compiler/optimizer/op.go Resolved
@mattnibs
mattnibs force-pushed the values-sort-keys branch 2 times, most recently from df61164 to 4866460 Compare October 30, 2026 16:53
analyzeSortKeys had no case for ValuesOp, so any values operator made
the sort order unknown even when it passed the sort key through
unchanged.  This blocked lifting values (and everything downstream of
it) into parallel paths ahead of a merge, e.g., the values operator
generated by every SQL SELECT.

A values operator with a single record expression without spreads is
now flattened into the equivalent cut assignments and analyzed the same
way as cut (analyzeCuts is renamed analyzeAssignments to reflect this).
ValuesOp is also added to the set of operators liftIntoParPaths may
copy into parallel paths.
@mattnibs
mattnibs merged commit ec54436 into main Oct 30, 2026
2 checks passed
@mattnibs
mattnibs deleted the values-sort-keys branch October 30, 2026 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants