Skip to content

Commit

Permalink
Speed up rounding in auto_date_histogram (#56384)
Browse files Browse the repository at this point in the history
This wires `auto_date_histogram` into the rounding optimization that I
built in #55559. This is should significantly speed up any
`auto_date_histogram`s with `time_zone`s on them.
  • Loading branch information
nik9000 authored May 9, 2020
1 parent 44b5c25 commit 12e9218
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.function.Function;

public final class AutoDateHistogramAggregatorFactory extends ValuesSourceAggregatorFactory {

Expand Down Expand Up @@ -77,9 +78,10 @@ protected Aggregator doCreateInternal(ValuesSource valuesSource,
throw new AggregationExecutionException("Registry miss-match - expected AutoDateHistogramAggregationSupplier, found [" +
aggregatorSupplier.getClass().toString() + "]");
}
Function<Rounding, Rounding.Prepared> roundingPreparer =
valuesSource.roundingPreparer(searchContext.getQueryShardContext().getIndexReader());
return ((AutoDateHistogramAggregatorSupplier) aggregatorSupplier).build(name, factories, numBuckets, roundingInfos,
// TODO once auto date histo is plugged into the ValuesSource refactoring use the date values source
Rounding::prepareForUnknown, valuesSource, config.format(), searchContext, parent, metadata);
roundingPreparer, valuesSource, config.format(), searchContext, parent, metadata);
}

@Override
Expand Down

0 comments on commit 12e9218

Please sign in to comment.