use of org.apache.druid.segment.BaseDoubleColumnValueSelector in project druid by druid-io.
the class ArrayOfDoublesSketchAggregatorFactory method factorizeBuffered.
@Override
public BufferAggregator factorizeBuffered(final ColumnSelectorFactory metricFactory) {
if (metricColumns == null) {
// input is sketches, use merge aggregator
final BaseObjectColumnValueSelector<ArrayOfDoublesSketch> selector = metricFactory.makeColumnValueSelector(fieldName);
if (selector instanceof NilColumnValueSelector) {
return new NoopArrayOfDoublesSketchBufferAggregator(numberOfValues);
}
return new ArrayOfDoublesSketchMergeBufferAggregator(selector, nominalEntries, numberOfValues, getMaxIntermediateSizeWithNulls());
}
// input is raw data (key and array of values), use build aggregator
final DimensionSelector keySelector = metricFactory.makeDimensionSelector(new DefaultDimensionSpec(fieldName, fieldName));
if (DimensionSelector.isNilSelector(keySelector)) {
return new NoopArrayOfDoublesSketchBufferAggregator(numberOfValues);
}
final List<BaseDoubleColumnValueSelector> valueSelectors = new ArrayList<>();
for (final String column : metricColumns) {
final BaseDoubleColumnValueSelector valueSelector = metricFactory.makeColumnValueSelector(column);
valueSelectors.add(valueSelector);
}
return new ArrayOfDoublesSketchBuildBufferAggregator(keySelector, valueSelectors, nominalEntries, getMaxIntermediateSizeWithNulls());
}
use of org.apache.druid.segment.BaseDoubleColumnValueSelector in project druid by druid-io.
the class ArrayOfDoublesSketchAggregatorFactory method factorize.
@Override
public Aggregator factorize(final ColumnSelectorFactory metricFactory) {
if (metricColumns == null) {
// input is sketches, use merge aggregator
final BaseObjectColumnValueSelector<ArrayOfDoublesSketch> selector = metricFactory.makeColumnValueSelector(fieldName);
if (selector instanceof NilColumnValueSelector) {
return new NoopArrayOfDoublesSketchAggregator(numberOfValues);
}
return new ArrayOfDoublesSketchMergeAggregator(selector, nominalEntries, numberOfValues);
}
// input is raw data (key and array of values), use build aggregator
final DimensionSelector keySelector = metricFactory.makeDimensionSelector(new DefaultDimensionSpec(fieldName, fieldName));
if (DimensionSelector.isNilSelector(keySelector)) {
return new NoopArrayOfDoublesSketchAggregator(numberOfValues);
}
final List<BaseDoubleColumnValueSelector> valueSelectors = new ArrayList<>();
for (final String column : metricColumns) {
final BaseDoubleColumnValueSelector valueSelector = metricFactory.makeColumnValueSelector(column);
valueSelectors.add(valueSelector);
}
return new ArrayOfDoublesSketchBuildAggregator(keySelector, valueSelectors, nominalEntries);
}
Aggregations