@Override public StatisticsId[] getSupportedStatistics() { return new StatisticsId[] { new StatisticsId(new BaseStatisticsType<>(statType), fieldName)}; } };
public RowRangeHistogramStatistics( final Short internalDataAdapterId, final String indexName, final byte[] partitionKey) { super( internalDataAdapterId, STATS_TYPE, PartitionStatisticsQueryBuilder.composeId(indexName, partitionKey)); histogram = createHistogram(); }
@Override public void entryIngested(final T entry, final GeoWaveRow... kvs) { if (statisticsBuilders == null) { return; } synchronized (MUTEX) { for (final DataStatisticsBuilder<T, ?, ?> builder : statisticsBuilders) { builder.entryIngested(entry, kvs); } updateCount++; checkStats(); } }
private void init() { int supportedStatsLength = 2; if (histogramConfig != null) { supportedStatsLength++; } supportedStats = new StatisticsId[supportedStatsLength]; supportedStats[0] = OverviewStatistics.STATS_TYPE.newBuilder().build().getId(); supportedStats[1] = BoundingBoxDataStatistics.STATS_TYPE.newBuilder().build().getId(); if (histogramConfig != null) { supportedStats[2] = HistogramStatistics.STATS_TYPE.newBuilder().build().getId(); } visibilityHandler = new DefaultFieldStatisticVisibility<>(); }
@Override public String toString() { return "AbstractDataStatistics [adapterId=" + adapterId + ", statisticsType=" + statisticsType.getString() + "]"; } }
@Override public void entryScanned(final T entry, final GeoWaveRow kv) { if (statisticsBuilders == null) { return; } synchronized (MUTEX) { for (final DataStatisticsBuilder<T, ?, ?> builder : statisticsBuilders) { builder.entryScanned(entry, kv); } updateCount++; checkStats(); } }
@Override public void entryDeleted(final T entry, final GeoWaveRow... kvs) { if (statisticsBuilders == null) { return; } synchronized (MUTEX) { for (final DataStatisticsBuilder<T, ?, ?> builder : statisticsBuilders) { builder.entryDeleted(entry, kvs); } updateCount++; checkStats(); } }
static <R> InternalDataStatistics<?, R, ?> reduce( final InternalDataStatistics<?, R, ?> a, final InternalDataStatistics<?, R, ?> b) { a.merge(b); return a; } }
public double[] quantile(final int bins) { final double[] result = new double[bins]; final double binSize = 1.0 / bins; for (int bin = 0; bin < bins; bin++) { result[bin] = quantile(binSize * (bin + 1)); } return result; }
@Override public void entryIngested(final T entry, final GeoWaveRow... kvs) { if (!isSet()) { count = 0; } count += 1; }
@Override public FieldStatisticsQueryBuilder<Interval> timeRange() { return TimeRangeDataStatistics.STATS_TYPE.newBuilder(); } }
private synchronized RowRangeHistogramStatistics<T> getPartitionStatistic( final byte[] partitionKey) { final ByteArray partitionKeyObj = getPartitionKey(partitionKey); RowRangeHistogramStatistics<T> histogram = histogramPerPartition.get(partitionKeyObj); if (histogram == null) { histogram = new RowRangeHistogramStatistics<>(adapterId, extendedId, partitionKey); histogramPerPartition.put(partitionKeyObj, histogram); } return histogram; }
@Override public void entryIngested(final T entry, final GeoWaveRow... kvs) { if (kvs.length > 0) { if (entryHasDuplicates(kvs[0])) { entriesWithDuplicates++; } } }
@Override public IndexStatisticsQueryBuilder<Set<ByteArray>> partitions() { return PartitionStatistics.STATS_TYPE.newBuilder(); } }
private void checkStats() { if (!skipFlush && (updateCount >= FLUSH_STATS_THRESHOLD)) { updateCount = 0; flush(); } } }
@Override public BaseStatisticsQueryBuilder<R> newBuilder() { return new BaseStatisticsQueryBuilder<>(this); } }
@Override public InternalDataStatistics<T, Integer, IndexStatisticsQueryBuilder<Integer>> duplicate() { return (InternalDataStatistics) new MaxDuplicatesStatistics<>( adapterId, extendedId, maxDuplicates); }
@Override public FieldStatisticsQueryBuilder<R> newBuilder() { return new FieldStatisticsQueryBuilder<>(this); } }
@Override public PartitionStatisticsQueryBuilder<R> newBuilder() { return new PartitionStatisticsQueryBuilder<>(this); } }
@Override public IndexStatisticsQueryBuilder<R> newBuilder() { return new IndexStatisticsQueryBuilder<>(this); } }