-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Add bucketedSort based on int #128848
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
elasticsearchmachine
merged 7 commits into
elastic:main
from
mayya-sharipova:sort_optimization_int_short_byte_bucketed_sort
Jun 3, 2025
Merged
Add bucketedSort based on int #128848
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
55e2fd4
Add bucketedSort based on int
mayya-sharipova 0e47a9c
Update docs/changelog/128848.yaml
mayya-sharipova 98bfbdf
Merge branch 'main' into sort_optimization_int_short_byte_bucketed_sort
mayya-sharipova e3aba40
Add test
mayya-sharipova 8c87808
Merge branch 'main' into sort_optimization_int_short_byte_bucketed_sort
mayya-sharipova f86f3ee
Merge branch 'main' into sort_optimization_int_short_byte_bucketed_sort
mayya-sharipova 057f3d1
Merge branch 'main' into sort_optimization_int_short_byte_bucketed_sort
mayya-sharipova File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,5 @@ | ||
| pr: 128848 | ||
| summary: Add `bucketedSort` based on int | ||
| area: Search | ||
| type: enhancement | ||
| issues: [] |
This file contains hidden or 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 hidden or 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
54 changes: 54 additions & 0 deletions
54
server/src/test/java/org/elasticsearch/search/sort/BucketedSortForIntsTests.java
This file contains hidden or 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,54 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the "Elastic License | ||
| * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
| * Public License v 1"; you may not use this file except in compliance with, at | ||
| * your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
| * License v3.0 only", or the "Server Side Public License, v 1". | ||
| */ | ||
|
|
||
| package org.elasticsearch.search.sort; | ||
|
|
||
| import org.apache.lucene.index.LeafReaderContext; | ||
| import org.elasticsearch.search.DocValueFormat; | ||
|
|
||
| public class BucketedSortForIntsTests extends BucketedSortTestCase<BucketedSort.ForInts> { | ||
| @Override | ||
| public BucketedSort.ForInts build( | ||
| SortOrder sortOrder, | ||
| DocValueFormat format, | ||
| int bucketSize, | ||
| BucketedSort.ExtraData extra, | ||
| double[] values | ||
| ) { | ||
| return new BucketedSort.ForInts(bigArrays(), sortOrder, format, bucketSize, extra) { | ||
| @Override | ||
| public Leaf forLeaf(LeafReaderContext ctx) { | ||
| return new Leaf(ctx) { | ||
| int index = -1; | ||
|
|
||
| @Override | ||
| protected boolean advanceExact(int doc) { | ||
| index = doc; | ||
| return doc < values.length; | ||
| } | ||
|
|
||
| @Override | ||
| protected int docValue() { | ||
| return (int) values[index]; | ||
| } | ||
| }; | ||
| } | ||
| }; | ||
| } | ||
|
|
||
| @Override | ||
| protected SortValue expectedSortValue(double v) { | ||
| return SortValue.from((int) v); | ||
| } | ||
|
|
||
| @Override | ||
| protected double randomValue() { | ||
| return randomInt(); | ||
| } | ||
| } |
This file contains hidden or 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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's a BucketedSortForLongsTests should there also be a BucketedSortForIntsTests now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in e3aba40