Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -592,11 +592,10 @@ public void testOverlappingRanges() throws IOException {
/**
* If the top level query is a runtime field we use the standard aggregator
* because it's marginally faster. You'd expect it to be a *ton* faster but
* usually the ranges drive the iteration and they are still fairly fast.
* usually the ranges drive the iteration, and they are still fairly fast.
* But the union operation overhead that comes with combining the range with
* the top level query tends to slow us down more than the standard aggregator.
*/
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/128471")
public void testRuntimeFieldTopLevelQueryNotOptimized() throws IOException {
long totalDocs = (long) RangeAggregator.DOCS_PER_RANGE_TO_USE_FILTERS * 4;
SearchLookup lookup = new SearchLookup(s -> null, (ft, l, ftd) -> null, (ctx, doc) -> null);
Expand All @@ -609,7 +608,8 @@ public void execute() {
Query query = new StringScriptFieldTermQuery(new Script("dummy"), scriptFactory, "dummy", "cat", false);
debugTestCase(new RangeAggregationBuilder("r").field(NUMBER_FIELD_NAME).addRange(0, 1).addRange(1, 2).addRange(2, 3), query, iw -> {
for (int d = 0; d < totalDocs; d++) {
iw.addDocument(List.of(new IntPoint(NUMBER_FIELD_NAME, 0), new SortedNumericDocValuesField(NUMBER_FIELD_NAME, 0)));
int v = d % 2;
iw.addDocument(List.of(new IntPoint(NUMBER_FIELD_NAME, v), new SortedNumericDocValuesField(NUMBER_FIELD_NAME, v)));
}
}, (InternalRange<?, ?> r, Class<? extends Aggregator> impl, Map<String, Map<String, Object>> debug) -> {
assertThat(
Expand All @@ -620,7 +620,7 @@ public void execute() {
assertThat(r.getBuckets().stream().map(InternalRange.Bucket::getTo).collect(toList()), equalTo(List.of(1.0, 2.0, 3.0)));
assertThat(
r.getBuckets().stream().map(InternalRange.Bucket::getDocCount).collect(toList()),
equalTo(List.of(totalDocs, 0L, 0L))
equalTo(List.of(totalDocs / 2, totalDocs / 2, 0L))
);
assertThat(impl, equalTo(RangeAggregator.NoOverlap.class));
assertMap(
Expand Down