-
Notifications
You must be signed in to change notification settings - Fork 2.4k
[Aggregations] Optimize singleton handling in GlobalOrdinalValuesSource #17740
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
[Aggregations] Optimize singleton handling in GlobalOrdinalValuesSource #17740
Conversation
|
❌ Gradle check result for 7a979ba: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
|
{"run-benchmark-test": "id_4"} |
...main/java/org/opensearch/search/aggregations/bucket/composite/GlobalOrdinalValuesSource.java
Show resolved
Hide resolved
|
❌ Gradle check result for f715191: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
f715191 to
8ec48cd
Compare
|
❌ Gradle check result for 8ec48cd: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
Signed-off-by: shreyah963 <shreyab963@gmail.com>
Signed-off-by: shreyah963 <shreyab963@gmail.com>
Signed-off-by: shreyah963 <shreyab963@gmail.com>
…esSource and simplify the optimization logic in GlobalOrdinalValuesSource. The singleton optimization is now only applied when DocValues.unwrapSingleton() succeeds, preventing array index out of bounds errors with high cardinality fields. Signed-off-by: shreyah963 <shreyab963@gmail.com>
Signed-off-by: shreyah963 <shreyab963@gmail.com>
Signed-off-by: shreyah963 <shreyab963@gmail.com>
Signed-off-by: shreyah963 <shreyab963@gmail.com>
Signed-off-by: shreyah963 <shreyab963@gmail.com>
Signed-off-by: shreyah963 <shreyab963@gmail.com>
8ec48cd to
4a13f79
Compare
|
❌ Gradle check result for 4a13f79: Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
|
❕ Gradle check result for 4a13f79: UNSTABLE Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #17740 +/- ##
============================================
+ Coverage 72.46% 72.48% +0.02%
- Complexity 66502 66519 +17
============================================
Files 5408 5408
Lines 308080 308192 +112
Branches 44720 44749 +29
============================================
+ Hits 223239 223396 +157
- Misses 66536 66537 +1
+ Partials 18305 18259 -46 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@shreyah963 - Can you add CHANGELOG entry as well? |
Signed-off-by: shreyah963 <shreyab963@gmail.com>
Signed-off-by: shreyah963 <shreyab963@gmail.com>
...main/java/org/opensearch/search/aggregations/bucket/composite/GlobalOrdinalValuesSource.java
Outdated
Show resolved
Hide resolved
Co-authored-by: bowenlan-amzn <bowenlan23@gmail.com> Signed-off-by: shreyah963 <shreyab963@gmail.com>
Signed-off-by: shreyah963 <shreyab963@gmail.com>
|
❕ Gradle check result for d93f589: UNSTABLE Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure. |
Signed-off-by: Ankit Jain <akjain@amazon.com>
|
❕ Gradle check result for a6f9f4f: UNSTABLE Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure. |
|
The backport to To backport manually, run these commands in your terminal: # Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/OpenSearch/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/OpenSearch/backport-2.x
# Create a new branch
git switch --create backport/backport-17740-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 38231693572bd00363db1b0221a0bc632c4ceef2
# Push it to GitHub
git push --set-upstream origin backport/backport-17740-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/OpenSearch/backport-2.xThen, create a pull request where the |
…ce (opensearch-project#17740) * added singleton optimization path to globalordinalvaluesource Signed-off-by: shreyah963 <shreyab963@gmail.com> * enabled remote debugging Signed-off-by: shreyah963 <shreyab963@gmail.com> * Removed the minimum cap to handle larger ordinal values Signed-off-by: shreyah963 <shreyab963@gmail.com> * emove redundant singleton optimization state from SingleDimensionValuesSource and simplify the optimization logic in GlobalOrdinalValuesSource. The singleton optimization is now only applied when DocValues.unwrapSingleton() succeeds, preventing array index out of bounds errors with high cardinality fields. Signed-off-by: shreyah963 <shreyab963@gmail.com> * removed redundant initialization Signed-off-by: shreyah963 <shreyab963@gmail.com> * reverted the array allocation in the constructer to its original form Signed-off-by: shreyah963 <shreyab963@gmail.com> * [Docs] Add detailed comments to GlobalOrdinalValuesSource collector Signed-off-by: shreyah963 <shreyab963@gmail.com> * Remote redundant imports and disable remote debugging Signed-off-by: shreyah963 <shreyab963@gmail.com> * replaced wildcard import with only necessary imports Signed-off-by: shreyah963 <shreyab963@gmail.com> * Update CHANGELOG.md Signed-off-by: shreyah963 <shreyab963@gmail.com> * Update CHANGELOG.md Co-authored-by: bowenlan-amzn <bowenlan23@gmail.com> Signed-off-by: shreyah963 <shreyab963@gmail.com> * Remove redundant comments from GlobalOrdinalValuesSource Signed-off-by: shreyah963 <shreyab963@gmail.com> --------- Signed-off-by: shreyah963 <shreyab963@gmail.com> Signed-off-by: Ankit Jain <akjain@amazon.com> Co-authored-by: bowenlan-amzn <bowenlan23@gmail.com> Co-authored-by: Ankit Jain <akjain@amazon.com> Signed-off-by: Harsh Kothari <techarsh@amazon.com>
…ce (opensearch-project#17740) * added singleton optimization path to globalordinalvaluesource Signed-off-by: shreyah963 <shreyab963@gmail.com> * enabled remote debugging Signed-off-by: shreyah963 <shreyab963@gmail.com> * Removed the minimum cap to handle larger ordinal values Signed-off-by: shreyah963 <shreyab963@gmail.com> * emove redundant singleton optimization state from SingleDimensionValuesSource and simplify the optimization logic in GlobalOrdinalValuesSource. The singleton optimization is now only applied when DocValues.unwrapSingleton() succeeds, preventing array index out of bounds errors with high cardinality fields. Signed-off-by: shreyah963 <shreyab963@gmail.com> * removed redundant initialization Signed-off-by: shreyah963 <shreyab963@gmail.com> * reverted the array allocation in the constructer to its original form Signed-off-by: shreyah963 <shreyab963@gmail.com> * [Docs] Add detailed comments to GlobalOrdinalValuesSource collector Signed-off-by: shreyah963 <shreyab963@gmail.com> * Remote redundant imports and disable remote debugging Signed-off-by: shreyah963 <shreyab963@gmail.com> * replaced wildcard import with only necessary imports Signed-off-by: shreyah963 <shreyab963@gmail.com> * Update CHANGELOG.md Signed-off-by: shreyah963 <shreyab963@gmail.com> * Update CHANGELOG.md Co-authored-by: bowenlan-amzn <bowenlan23@gmail.com> Signed-off-by: shreyah963 <shreyab963@gmail.com> * Remove redundant comments from GlobalOrdinalValuesSource Signed-off-by: shreyah963 <shreyab963@gmail.com> --------- Signed-off-by: shreyah963 <shreyab963@gmail.com> Signed-off-by: Ankit Jain <akjain@amazon.com> Co-authored-by: bowenlan-amzn <bowenlan23@gmail.com> Co-authored-by: Ankit Jain <akjain@amazon.com> Signed-off-by: Harsh Kothari <techarsh@amazon.com>
Description
This PR optimizes the handling of single-valued fields in composite aggregations by modifying how we process ordinal values in GlobalOrdinalValuesSource. The key change is eliminating the need for iterative ordinal processing when we can use Lucene's singleton optimization.
Key Changes:
In GlobalOrdinalValuesSource.getLeafCollector(), we replace the iterative ordinal processing:
The key improvement is removing the while loop for single-valued fields. Instead of iterating through ordinals (which is unnecessary for single values), we now:
Performance Impact:
Testing Performance Improvement
Infrastructure Details
Run 1
Before change
After change
Run 2
Before change
After change
Run 3
Before change
After change
Run 4
Before change
After change
Run 5
Before change
After change
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.