forked from elastic/elasticsearch
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SQL: Avoid empty last pages for GROUP BY queries when possible (elast…
…ic#84356) Resolves elastic#75528. Instead of always returning an empty last page for `GROUP BY` queries, `CompositeAggCursor` will now only do so if it is not possible to tell wether there are more pages based on the composite aggregation response. This is the case in two situations: * The last page contains exactly `fetch_size` results. In this case, the composite aggregation return an `after_key` even if there are no more keys remaining (see also elastic#75573) * The query uses a bucket selector. In this case, the composite aggregation might return partial pages with less than `size` buckets and the `buckets.size() < sizeRequested` heuristic for detecting last pages does no longer work. Hence, if any (or both) of the two conditions above applies, SQL will still return an empty last page. If neither of the conditions apply, the last page will always be non-empty. This PR is also a weak prerequisite for addressing elastic#84349 because it allows to immediately close PITs for aggregation queries returning only one page. As a result the performance impact of using PIT for aggregations should be minimized.
- Loading branch information
Showing
9 changed files
with
146 additions
and
83 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
pr: 84356 | ||
summary: Avoid empty last pages for GROUP BY queries when possible | ||
area: SQL | ||
type: bug | ||
issues: | ||
- 75528 |
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.