Skip to content

Commit 2faadcd

Browse files
harshavamsiPeter Alfonsi
authored andcommitted
Expand streaming aggregations to numeric terms (opensearch-project#19335)
* Expand streaming aggregations to numeric terms Signed-off-by: Harsha Vamsi Kalluri <harshavamsi096@gmail.com> * Add tests Signed-off-by: Harsha Vamsi Kalluri <harshavamsi096@gmail.com> * Changelog Signed-off-by: Harsha Vamsi Kalluri <harshavamsi096@gmail.com> * Fix gradle assemble Signed-off-by: Harsha Vamsi Kalluri <harshavamsi096@gmail.com> * update test coverage Signed-off-by: Harsha Vamsi Kalluri <harshavamsi096@gmail.com> * remove custom stream package Signed-off-by: Harsha Vamsi Kalluri <harshavamsi096@gmail.com> * remove custom stream package Signed-off-by: Harsha Vamsi Kalluri <harshavamsi096@gmail.com> * remove unused results Signed-off-by: Harsha Vamsi Kalluri <harshavamsi096@gmail.com> --------- Signed-off-by: Harsha Vamsi Kalluri <harshavamsi096@gmail.com>
1 parent 33b8f7a commit 2faadcd

File tree

8 files changed

+2335
-37
lines changed

8 files changed

+2335
-37
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5050
- Add sub aggregation support for histogram aggregation using skiplist ([19438](https://github.com/opensearch-project/OpenSearch/pull/19438))
5151
- Optimization in String Terms Aggregation query for Large Bucket Counts([#18732](https://github.com/opensearch-project/OpenSearch/pull/18732))
5252
- New cluster setting search.query.max_query_string_length ([#19491](https://github.com/opensearch-project/OpenSearch/pull/19491))
53+
- Add `StreamNumericTermsAggregator` to allow numeric term aggregation streaming ([#19335](https://github.com/opensearch-project/OpenSearch/pull/19335))
5354

5455
### Changed
5556
- Refactor `if-else` chains to use `Java 17 pattern matching switch expressions`(([#18965](https://github.com/opensearch-project/OpenSearch/pull/18965))

server/src/main/java/org/opensearch/search/aggregations/bucket/BucketsAggregator.java

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
import java.io.IOException;
5454
import java.util.AbstractList;
5555
import java.util.ArrayList;
56-
import java.util.Arrays;
5756
import java.util.Iterator;
5857
import java.util.List;
5958
import java.util.Map;
@@ -260,23 +259,6 @@ public int size() {
260259
return result;
261260
}
262261

263-
/**
264-
* Build the sub aggregation results for a list of buckets and set them on
265-
* the buckets. This is usually used by aggregations that are selective
266-
* in which bucket they build. They use some mechanism of selecting a list
267-
* of buckets to build use this method to "finish" building the results.
268-
* @param buckets the buckets to finish building
269-
* @param bucketToOrd how to convert a bucket into an ordinal
270-
* @param setAggs how to set the sub-aggregation results on a bucket
271-
*/
272-
protected final <B> void buildSubAggsForBuckets(B[] buckets, ToLongFunction<B> bucketToOrd, BiConsumer<B, InternalAggregations> setAggs)
273-
throws IOException {
274-
InternalAggregations[] results = buildSubAggsForBuckets(Arrays.stream(buckets).mapToLong(bucketToOrd).toArray());
275-
for (int i = 0; i < buckets.length; i++) {
276-
setAggs.accept(buckets[i], results[i]);
277-
}
278-
}
279-
280262
/**
281263
* Build the sub aggregation results for a list of buckets and set them on
282264
* the buckets. This is usually used by aggregations that are selective

server/src/main/java/org/opensearch/search/aggregations/bucket/terms/InternalSignificantTerms.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public interface Reader<B extends Bucket<B>> {
8888
long supersetSize;
8989
long bucketOrd;
9090
double score;
91-
protected InternalAggregations aggregations;
91+
InternalAggregations aggregations;
9292
final transient DocValueFormat format;
9393

9494
protected Bucket(

server/src/main/java/org/opensearch/search/aggregations/bucket/terms/InternalTerms.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ public interface Reader<B extends Bucket<B>> {
106106

107107
long bucketOrd;
108108

109-
protected long docCount;
109+
long docCount;
110110
protected long docCountError;
111-
protected InternalAggregations aggregations;
111+
InternalAggregations aggregations;
112112
protected final boolean showDocCountError;
113113
protected final DocValueFormat format;
114114

0 commit comments

Comments
 (0)