-
Notifications
You must be signed in to change notification settings - Fork 2k
Support Nested Aggregations as part of Star-Tree #18048
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
base: main
Are you sure you want to change the base?
Support Nested Aggregations as part of Star-Tree #18048
Conversation
server/src/main/java/org/opensearch/search/aggregations/StarTreePreComputeCollector.java
Show resolved
Hide resolved
❌ Gradle check result for 16f18d9: 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? |
), | ||
context | ||
) | ||
parent == null |
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.
lets add some comments please on why its done this way
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 block of code can be extracted out and get reused ?
...ava/org/opensearch/search/aggregations/bucket/terms/GlobalOrdinalsStringTermsAggregator.java
Show resolved
Hide resolved
...ava/org/opensearch/search/aggregations/bucket/terms/GlobalOrdinalsStringTermsAggregator.java
Outdated
Show resolved
Hide resolved
...ava/org/opensearch/search/aggregations/bucket/terms/GlobalOrdinalsStringTermsAggregator.java
Show resolved
Hide resolved
server/src/main/java/org/opensearch/search/startree/StarTreeTraversalUtil.java
Show resolved
Hide resolved
test/framework/src/main/java/org/opensearch/search/aggregations/AggregatorTestCase.java
Show resolved
Hide resolved
16f18d9
to
b3bee6c
Compare
❌ Gradle check result for b3bee6c: 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? |
* | ||
* @return List of dimension field names involved in the aggregation. | ||
*/ | ||
default List<String> getDimensionFilters() { |
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.
StarTreePreComputeCollector
is only involved for aggregations not including Metric aggregators. You can very well define the method here, instead of having the same implementation everywhere. (overlooking the overrides - the implementations look same.
/* For nested aggregations, we require the RemapGlobalOrdsStarTree strategy to properly | ||
handle global ordinal remapping. This check ensures we don't reinitialize the | ||
collectionStrategy again if it's already correctly set. */ | ||
if (parent != null && !(collectionStrategy instanceof RemapGlobalOrdsStarTree)) { |
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 had fixed redundant initialization of globalOrds as part of this change #18059 (pending merge)
Make sure that the changes don't break.
), | ||
context | ||
) | ||
parent == null |
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.
Return null
early in the method itself when parent != null
Basically we don't want to run the follwoing steps in case parent is not null - since the parent will be executing all this:
StarTreeValues starTreeValues = StarTreeQueryHelper.getStarTreeValues(ctx, starTree);
SortedNumericStarTreeValuesIterator valuesIterator = (SortedNumericStarTreeValuesIterator) starTreeValues
.getDimensionValuesIterator(fieldName);
SortedNumericStarTreeValuesIterator docCountsIterator = StarTreeQueryHelper.getDocCountsIterator(starTreeValues, starTree);
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.
Return null early in the method itself when parent != null
This would not work I believe, if parent != null, we would still need to return an object of StarTreeBucketCollector
as we have to call collectStarTreeEntry()
for the subcollectors.
for (StarTreeBucketCollector subCollector : collector.getSubCollectors()) {
subCollector.collectStarTreeEntry(entryBit, bucketOrd);
}
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.
Ohh I missed that. No worries.
} | ||
} | ||
|
||
if (!isValid) return false; |
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.
nit: Just to maintain boolean check consistency across project: isValid == false
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.
sure.
Thanks @Shailesh-Kumar-Singh for working on this. Code wise, I only have a few refactoring comments on the implementation. I have some concerns regarding the supported cases: What is the break-point of nested aggregators to use or not use star-tree, like upto how many nested levels? |
❌ Gradle check result for a58027f: 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? |
Description
Support Nested Aggregations as part of Star-Tree
Related Issues
Resolves #17274
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.