-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
colexec: fix hash aggregator when spilling to disk
In some cases the aggregation is expected to maintain the required ordering in order to eliminate an explicit sort afterwards. It is always the case that the required ordering is a prefix of ordered grouping columns. With the introduction of disk spilling for the vectorized hash aggregator in 21.1 release the ordering was no longer maintained if the spilling occurs. In all previous cases (row-by-row processors and in-memory columnar operator) the ordering was maintained by construction, but with `hashBasedPartitioner` the ordering can be arbitrary. In order to fix this issue we now do what we did for the external distinct - we plan an external sort on top of the external hash aggregator to restore the required ordering. Note that this will only kick in if the spilling to disk occurred. This required changes to the AggregatorSpec to propagate the required output ordering. Release note (bug fix): In 21.1 alpha and beta releases CockroachDB could return the output in an incorrect order if the query containing hash aggregation was executed via the vectorized engine and spilling to temporary storage was required, in some cases.
- Loading branch information
1 parent
d511fb4
commit ef13232
Showing
11 changed files
with
372 additions
and
253 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.