-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Removed unused array #15364
Removed unused array #15364
Conversation
Signed-off-by: Dmitry Kryukov <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #15364 +/- ##
=========================================
Coverage 72.00% 72.00%
+ Complexity 64817 64783 -34
=========================================
Files 5307 5307
Lines 302660 302657 -3
Branches 43724 43723 -1
=========================================
+ Hits 217931 217942 +11
+ Misses 66906 66825 -81
- Partials 17823 17890 +67 ☔ View full report in Codecov by Sentry. |
server/src/main/java/org/opensearch/search/aggregations/bucket/BucketsAggregator.java
Show resolved
Hide resolved
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.
I wonder if this is hiding a bug and the intermediate value was supposed to be used. Maybe someone who understands agg can take a look? @Bukhtawar?
I looked up the commit which added it: 2f38aeb#diff-2d2b27a2755fd2a1d43780adc7cda194f64673c4bc655c5a80c1c167cb5bd1e9 No other references of Also, tried finding its reference in code, looks like this got added as a dead code in the above commit.
@dblock I don't think slowing things down would have been the intention. @msfroh Is there an uncompleted implementation of some optimization that we may be overlooking? |
I meant that below the code does |
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.
This looks correct to me.
It feels very much like this was left over from some refactoring within the commit that introduced this array.
Specifically, I'm pretty sure that at one point line 229 (now line 225) was:
result[ord] = InternalAggregations.from(Arrays.asList(slice));
I suspect that either the original author or their reviewer objected to the number of additional objects/arrays being created, so they suggested wrapping list views over existing 2D arrays (but in column order, rather than row order).
Of course, they still left the code that created the unnecessary array -- they just let it get garbage-collected right away.
@msfroh So ok to merge as is? Hit merge? |
This PR is stalled because it has been open for 30 days with no activity. |
Signed-off-by: Dmitry Kryukov <[email protected]> (cherry picked from commit 5817710) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
(cherry picked from commit 5817710) Signed-off-by: Dmitry Kryukov <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Removed unused array