Skip to content

Commit

Permalink
InternalMultiTermsTests#testReduceWithDoublePromotion should reduce f…
Browse files Browse the repository at this point in the history
…or final (#106750)
  • Loading branch information
iverase authored Mar 26, 2024
1 parent f34f5d4 commit 1688801
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.elasticsearch.search.aggregations.AggregationReduceContext;
import org.elasticsearch.search.aggregations.BucketOrder;
import org.elasticsearch.search.aggregations.InternalAggregations;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.SamplingContext;
import org.elasticsearch.test.InternalAggregationTestCase;
import org.elasticsearch.xpack.analytics.AnalyticsPlugin;
Expand Down Expand Up @@ -358,18 +359,20 @@ public void testReduceWithDoublePromotion() {
keyConverters2,
null
);
AggregationReduceContext context = new AggregationReduceContext.ForPartial(
AggregationReduceContext context = new AggregationReduceContext.ForFinal(
bigArrays,
mockScriptService,
() -> false,
mock(AggregationBuilder.class)
mock(AggregationBuilder.class),
i -> {},
PipelineAggregator.PipelineTree.EMPTY
);

InternalMultiTerms result = (InternalMultiTerms) InternalAggregationTestCase.reduce(List.of(terms1, terms2), context);
assertThat(result.buckets, hasSize(3));
assertThat(result.buckets.get(0).getKeyAsString(), equalTo("4|9.223372036854776E18|4.0"));
assertThat(result.buckets.get(0).getKeyAsString(), equalTo("4|9.223372036854776E18|1.0"));
assertThat(result.buckets.get(0).getDocCount(), equalTo(3L));
assertThat(result.buckets.get(1).getKeyAsString(), equalTo("4|9.223372036854776E18|1.0"));
assertThat(result.buckets.get(1).getKeyAsString(), equalTo("4|9.223372036854776E18|4.0"));
assertThat(result.buckets.get(1).getDocCount(), equalTo(3L));
assertThat(result.buckets.get(2).getKeyAsString(), equalTo("3|9.223372036854776E18|3.0"));
assertThat(result.buckets.get(2).getDocCount(), equalTo(2L));
Expand Down

0 comments on commit 1688801

Please sign in to comment.