Search in sources :

Example 1 with InternalHDRPercentileRanks

use of org.elasticsearch.search.aggregations.metrics.percentiles.hdr.InternalHDRPercentileRanks in project elasticsearch by elastic.

the class InternalHDRPercentilesRanksTests method assertReduced.

@Override
protected void assertReduced(InternalHDRPercentileRanks reduced, List<InternalHDRPercentileRanks> inputs) {
    // it is hard to check the values due to the inaccuracy of the algorithm
    long totalCount = 0;
    for (InternalHDRPercentileRanks ranks : inputs) {
        totalCount += ranks.state.getTotalCount();
    }
    assertEquals(totalCount, reduced.state.getTotalCount());
}
Also used : InternalHDRPercentileRanks(org.elasticsearch.search.aggregations.metrics.percentiles.hdr.InternalHDRPercentileRanks)

Example 2 with InternalHDRPercentileRanks

use of org.elasticsearch.search.aggregations.metrics.percentiles.hdr.InternalHDRPercentileRanks in project elasticsearch by elastic.

the class InternalHDRPercentilesRanksTests method createTestInstance.

@Override
protected InternalHDRPercentileRanks createTestInstance(String name, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData) {
    double[] cdfValues = new double[] { 0.5 };
    int numberOfSignificantValueDigits = 3;
    DoubleHistogram state = new DoubleHistogram(numberOfSignificantValueDigits);
    int numValues = randomInt(100);
    for (int i = 0; i < numValues; ++i) {
        state.recordValue(randomDouble());
    }
    boolean keyed = false;
    DocValueFormat format = DocValueFormat.RAW;
    return new InternalHDRPercentileRanks(name, cdfValues, state, keyed, format, pipelineAggregators, metaData);
}
Also used : DoubleHistogram(org.HdrHistogram.DoubleHistogram) DocValueFormat(org.elasticsearch.search.DocValueFormat) InternalHDRPercentileRanks(org.elasticsearch.search.aggregations.metrics.percentiles.hdr.InternalHDRPercentileRanks)

Aggregations

InternalHDRPercentileRanks (org.elasticsearch.search.aggregations.metrics.percentiles.hdr.InternalHDRPercentileRanks)2 DoubleHistogram (org.HdrHistogram.DoubleHistogram)1 DocValueFormat (org.elasticsearch.search.DocValueFormat)1