41
41
import org .opensearch .index .mapper .MappedFieldType ;
42
42
import org .opensearch .index .mapper .MapperService ;
43
43
import org .opensearch .index .mapper .NumberFieldMapper ;
44
- import org .opensearch .index .query .MatchAllQueryBuilder ;
45
44
import org .opensearch .index .query .QueryBuilder ;
46
45
import org .opensearch .index .query .QueryShardContext ;
47
46
import org .opensearch .index .query .TermQueryBuilder ;
@@ -285,8 +284,7 @@ public void testStarTreeDocValues() throws IOException {
285
284
);
286
285
287
286
// Test that feature parity is maintained for unmapped field names.
288
- sumAggregationBuilder = new SumAggregationBuilder ("sumaggs" ).field ("hello" );
289
- queryBuilder = new MatchAllQueryBuilder ();
287
+ sumAggregationBuilder = sum ("sumaggs" ).field ("hello" );
290
288
testCase (
291
289
indexSearcher ,
292
290
query ,
@@ -295,7 +293,8 @@ public void testStarTreeDocValues() throws IOException {
295
293
starTree ,
296
294
supportedDimensions ,
297
295
verifyAggregation (InternalSum ::getValue ),
298
- sumAggregationBuilder .build (queryShardContext , null )
296
+ sumAggregationBuilder .build (queryShardContext , null ),
297
+ false // Invalid fields will return null Star Query Context which will not cause early termination for leaf collector
299
298
);
300
299
301
300
ir .close ();
@@ -319,7 +318,7 @@ private <T extends AggregationBuilder, V extends InternalAggregation> void testC
319
318
List <Dimension > supportedDimensions ,
320
319
BiConsumer <V , V > verify
321
320
) throws IOException {
322
- testCase (searcher , query , queryBuilder , aggBuilder , starTree , supportedDimensions , verify , null );
321
+ testCase (searcher , query , queryBuilder , aggBuilder , starTree , supportedDimensions , verify , null , true );
323
322
}
324
323
325
324
private <T extends AggregationBuilder , V extends InternalAggregation > void testCase (
@@ -330,7 +329,8 @@ private <T extends AggregationBuilder, V extends InternalAggregation> void testC
330
329
CompositeIndexFieldInfo starTree ,
331
330
List <Dimension > supportedDimensions ,
332
331
BiConsumer <V , V > verify ,
333
- AggregatorFactory aggregatorFactory
332
+ AggregatorFactory aggregatorFactory ,
333
+ boolean assertCollectorEarlyTermination
334
334
) throws IOException {
335
335
V starTreeAggregation = searchAndReduceStarTree (
336
336
createIndexSettings (),
@@ -343,6 +343,7 @@ private <T extends AggregationBuilder, V extends InternalAggregation> void testC
343
343
DEFAULT_MAX_BUCKETS ,
344
344
false ,
345
345
aggregatorFactory ,
346
+ assertCollectorEarlyTermination ,
346
347
DEFAULT_MAPPED_FIELD
347
348
);
348
349
V expectedAggregation = searchAndReduceStarTree (
@@ -356,6 +357,7 @@ private <T extends AggregationBuilder, V extends InternalAggregation> void testC
356
357
DEFAULT_MAX_BUCKETS ,
357
358
false ,
358
359
aggregatorFactory ,
360
+ assertCollectorEarlyTermination ,
359
361
DEFAULT_MAPPED_FIELD
360
362
);
361
363
verify .accept (expectedAggregation , starTreeAggregation );
0 commit comments