Package org.elasticsearch.search.aggregations.metrics.percentiles.tdigest

Examples of org.elasticsearch.search.aggregations.metrics.percentiles.tdigest.TDigestState


    public abstract double value(double key);

    @Override
    public AbstractInternalPercentiles reduce(ReduceContext reduceContext) {
        List<InternalAggregation> aggregations = reduceContext.aggregations();
        TDigestState merged = null;
        for (InternalAggregation aggregation : aggregations) {
            final AbstractInternalPercentiles percentiles = (AbstractInternalPercentiles) aggregation;
            if (merged == null) {
                merged = new TDigestState(percentiles.state.compression());
            }
            merged.add(percentiles.state);
        }
        return createReduced(getName(), keys, merged, keyed, getMetaData());
    }
View Full Code Here


    @Override
    public void collect(int doc, long bucketOrd) throws IOException {
        states = bigArrays.grow(states, bucketOrd + 1);
   
        TDigestState state = states.get(bucketOrd);
        if (state == null) {
            state = new TDigestState(compression);
            states.set(bucketOrd, state);
        }
   
        values.setDocument(doc);
        final int valueCount = values.count();
        for (int i = 0; i < valueCount; i++) {
            state.add(values.valueAt(i));
        }
    }
View Full Code Here

    protected TDigestState getState(long bucketOrd) {
        if (bucketOrd >= states.size()) {
            return null;
        }
        final TDigestState state = states.get(bucketOrd);
        return state;
    }
View Full Code Here

        super(name, estimatedBucketsCount, valuesSource, context, parent, percents, compression, keyed, metaData);
    }

    @Override
    public InternalAggregation buildAggregation(long owningBucketOrdinal) {
        TDigestState state = getState(owningBucketOrdinal);
        if (state == null) {
            return buildEmptyAggregation();
        } else {
            return new InternalPercentiles(name, keys, state, keyed, getMetaData());
        }
View Full Code Here

        }
    }
   
    @Override
    public double metric(String name, long bucketOrd) {
        TDigestState state = getState(bucketOrd);
        if (state == null) {
            return Double.NaN;
        } else {
            return state.quantile(Double.parseDouble(name) / 100);
        }
    }
View Full Code Here

        }
    }

    @Override
    public InternalAggregation buildEmptyAggregation() {
        return new InternalPercentiles(name, keys, new TDigestState(compression), keyed, getMetaData());
    }
View Full Code Here

        super(name, estimatedBucketsCount, valuesSource, context, parent, percents, compression, keyed, metaData);
    }

    @Override
    public InternalAggregation buildAggregation(long owningBucketOrdinal) {
        TDigestState state = getState(owningBucketOrdinal);
        if (state == null) {
            return buildEmptyAggregation();
        } else {
            return new InternalPercentileRanks(name, keys, state, keyed, getMetaData());
        }
View Full Code Here

        }
    }

    @Override
    public InternalAggregation buildEmptyAggregation() {
        return new InternalPercentileRanks(name, keys, new TDigestState(compression), keyed, getMetaData());
    }
View Full Code Here

        return new InternalPercentileRanks(name, keys, new TDigestState(compression), keyed, getMetaData());
    }

    @Override
    public double metric(String name, long bucketOrd) {
        TDigestState state = getState(bucketOrd);
        if (state == null) {
            return Double.NaN;
        } else {
            return InternalPercentileRanks.percentileRank(state, Double.valueOf(name));
        }
View Full Code Here

TOP

Related Classes of org.elasticsearch.search.aggregations.metrics.percentiles.tdigest.TDigestState

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.