mirror of https://github.com/apache/druid.git
prefix no-op aggs with "Noop" (#6960)
This commit is contained in:
parent
4e23c11345
commit
a99f0ff450
|
@ -67,7 +67,7 @@ public class DistinctCountAggregatorFactory extends AggregatorFactory
|
|||
{
|
||||
DimensionSelector selector = makeDimensionSelector(columnFactory);
|
||||
if (selector == null) {
|
||||
return new EmptyDistinctCountAggregator();
|
||||
return new NoopDistinctCountAggregator();
|
||||
} else {
|
||||
return new DistinctCountAggregator(
|
||||
selector,
|
||||
|
@ -81,7 +81,7 @@ public class DistinctCountAggregatorFactory extends AggregatorFactory
|
|||
{
|
||||
DimensionSelector selector = makeDimensionSelector(columnFactory);
|
||||
if (selector == null) {
|
||||
return EmptyDistinctCountBufferAggregator.instance();
|
||||
return NoopDistinctCountBufferAggregator.instance();
|
||||
} else {
|
||||
return new DistinctCountBufferAggregator(makeDimensionSelector(columnFactory));
|
||||
}
|
||||
|
|
|
@ -21,10 +21,9 @@ package org.apache.druid.query.aggregation.distinctcount;
|
|||
|
||||
import org.apache.druid.query.aggregation.Aggregator;
|
||||
|
||||
public class EmptyDistinctCountAggregator implements Aggregator
|
||||
public class NoopDistinctCountAggregator implements Aggregator
|
||||
{
|
||||
|
||||
public EmptyDistinctCountAggregator()
|
||||
public NoopDistinctCountAggregator()
|
||||
{
|
||||
}
|
||||
|
|
@ -26,18 +26,18 @@ import java.nio.ByteBuffer;
|
|||
|
||||
/**
|
||||
* The difference from {@link org.apache.druid.query.aggregation.NoopBufferAggregator} is that
|
||||
* EmptyDistinctCountBufferAggregator returns 0 instead of null from {@link #get(ByteBuffer, int)}.
|
||||
* NoopDistinctCountBufferAggregator returns 0 instead of null from {@link #get(ByteBuffer, int)}.
|
||||
*/
|
||||
public final class EmptyDistinctCountBufferAggregator implements BufferAggregator
|
||||
public final class NoopDistinctCountBufferAggregator implements BufferAggregator
|
||||
{
|
||||
private static final EmptyDistinctCountBufferAggregator INSTANCE = new EmptyDistinctCountBufferAggregator();
|
||||
private static final NoopDistinctCountBufferAggregator INSTANCE = new NoopDistinctCountBufferAggregator();
|
||||
|
||||
static EmptyDistinctCountBufferAggregator instance()
|
||||
static NoopDistinctCountBufferAggregator instance()
|
||||
{
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
private EmptyDistinctCountBufferAggregator()
|
||||
private NoopDistinctCountBufferAggregator()
|
||||
{
|
||||
}
|
||||
|
|
@ -90,13 +90,13 @@ public class DoublesSketchAggregatorFactory extends AggregatorFactory
|
|||
&& ValueType.isNumeric(metricFactory.getColumnCapabilities(fieldName).getType())) {
|
||||
final ColumnValueSelector<Double> selector = metricFactory.makeColumnValueSelector(fieldName);
|
||||
if (selector instanceof NilColumnValueSelector) {
|
||||
return new DoublesSketchNoOpAggregator();
|
||||
return new NoopDoublesSketchAggregator();
|
||||
}
|
||||
return new DoublesSketchBuildAggregator(selector, k);
|
||||
}
|
||||
final ColumnValueSelector<DoublesSketch> selector = metricFactory.makeColumnValueSelector(fieldName);
|
||||
if (selector instanceof NilColumnValueSelector) {
|
||||
return new DoublesSketchNoOpAggregator();
|
||||
return new NoopDoublesSketchAggregator();
|
||||
}
|
||||
return new DoublesSketchMergeAggregator(selector, k);
|
||||
}
|
||||
|
@ -108,13 +108,13 @@ public class DoublesSketchAggregatorFactory extends AggregatorFactory
|
|||
&& ValueType.isNumeric(metricFactory.getColumnCapabilities(fieldName).getType())) {
|
||||
final ColumnValueSelector<Double> selector = metricFactory.makeColumnValueSelector(fieldName);
|
||||
if (selector instanceof NilColumnValueSelector) {
|
||||
return new DoublesSketchNoOpBufferAggregator();
|
||||
return new NoopDoublesSketchBufferAggregator();
|
||||
}
|
||||
return new DoublesSketchBuildBufferAggregator(selector, k, getMaxIntermediateSizeWithNulls());
|
||||
}
|
||||
final ColumnValueSelector<DoublesSketch> selector = metricFactory.makeColumnValueSelector(fieldName);
|
||||
if (selector instanceof NilColumnValueSelector) {
|
||||
return new DoublesSketchNoOpBufferAggregator();
|
||||
return new NoopDoublesSketchBufferAggregator();
|
||||
}
|
||||
return new DoublesSketchMergeBufferAggregator(selector, k, getMaxIntermediateSizeWithNulls());
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ public class DoublesSketchMergeAggregatorFactory extends DoublesSketchAggregator
|
|||
{
|
||||
final ColumnValueSelector<DoublesSketch> selector = metricFactory.makeColumnValueSelector(getFieldName());
|
||||
if (selector instanceof NilColumnValueSelector) {
|
||||
return new DoublesSketchNoOpAggregator();
|
||||
return new NoopDoublesSketchAggregator();
|
||||
}
|
||||
return new DoublesSketchMergeAggregator(selector, getK());
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ public class DoublesSketchMergeAggregatorFactory extends DoublesSketchAggregator
|
|||
{
|
||||
final ColumnValueSelector<DoublesSketch> selector = metricFactory.makeColumnValueSelector(getFieldName());
|
||||
if (selector instanceof NilColumnValueSelector) {
|
||||
return new DoublesSketchNoOpBufferAggregator();
|
||||
return new NoopDoublesSketchBufferAggregator();
|
||||
}
|
||||
return new DoublesSketchMergeBufferAggregator(selector, getK(), getMaxIntermediateSizeWithNulls());
|
||||
}
|
||||
|
|
|
@ -21,9 +21,8 @@ package org.apache.druid.query.aggregation.datasketches.quantiles;
|
|||
|
||||
import org.apache.druid.query.aggregation.Aggregator;
|
||||
|
||||
public class DoublesSketchNoOpAggregator implements Aggregator
|
||||
public class NoopDoublesSketchAggregator implements Aggregator
|
||||
{
|
||||
|
||||
@Override
|
||||
public Object get()
|
||||
{
|
||||
|
@ -51,5 +50,4 @@ public class DoublesSketchNoOpAggregator implements Aggregator
|
|||
{
|
||||
throw new UnsupportedOperationException("Not implemented");
|
||||
}
|
||||
|
||||
}
|
|
@ -24,9 +24,8 @@ import org.apache.druid.query.monomorphicprocessing.RuntimeShapeInspector;
|
|||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
public class DoublesSketchNoOpBufferAggregator implements BufferAggregator
|
||||
public class NoopDoublesSketchBufferAggregator implements BufferAggregator
|
||||
{
|
||||
|
||||
@Override
|
||||
public void init(final ByteBuffer buf, final int position)
|
||||
{
|
||||
|
@ -64,5 +63,4 @@ public class DoublesSketchNoOpBufferAggregator implements BufferAggregator
|
|||
public void inspectRuntimeShape(final RuntimeShapeInspector inspector)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
|
@ -93,7 +93,7 @@ public class ArrayOfDoublesSketchAggregatorFactory extends AggregatorFactory
|
|||
final BaseObjectColumnValueSelector<ArrayOfDoublesSketch> selector = metricFactory
|
||||
.makeColumnValueSelector(fieldName);
|
||||
if (selector instanceof NilColumnValueSelector) {
|
||||
return new ArrayOfDoublesSketchNoOpAggregator(numberOfValues);
|
||||
return new NoopArrayOfDoublesSketchAggregator(numberOfValues);
|
||||
}
|
||||
return new ArrayOfDoublesSketchMergeAggregator(selector, nominalEntries, numberOfValues);
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ public class ArrayOfDoublesSketchAggregatorFactory extends AggregatorFactory
|
|||
final DimensionSelector keySelector = metricFactory
|
||||
.makeDimensionSelector(new DefaultDimensionSpec(fieldName, fieldName));
|
||||
if (DimensionSelector.isNilSelector(keySelector)) {
|
||||
return new ArrayOfDoublesSketchNoOpAggregator(numberOfValues);
|
||||
return new NoopArrayOfDoublesSketchAggregator(numberOfValues);
|
||||
}
|
||||
final List<BaseDoubleColumnValueSelector> valueSelectors = new ArrayList<>();
|
||||
for (final String column : metricColumns) {
|
||||
|
@ -118,7 +118,7 @@ public class ArrayOfDoublesSketchAggregatorFactory extends AggregatorFactory
|
|||
final BaseObjectColumnValueSelector<ArrayOfDoublesSketch> selector = metricFactory
|
||||
.makeColumnValueSelector(fieldName);
|
||||
if (selector instanceof NilColumnValueSelector) {
|
||||
return new ArrayOfDoublesSketchNoOpBufferAggregator(numberOfValues);
|
||||
return new NoopArrayOfDoublesSketchBufferAggregator(numberOfValues);
|
||||
}
|
||||
return new ArrayOfDoublesSketchMergeBufferAggregator(
|
||||
selector,
|
||||
|
@ -131,7 +131,7 @@ public class ArrayOfDoublesSketchAggregatorFactory extends AggregatorFactory
|
|||
final DimensionSelector keySelector = metricFactory
|
||||
.makeDimensionSelector(new DefaultDimensionSpec(fieldName, fieldName));
|
||||
if (DimensionSelector.isNilSelector(keySelector)) {
|
||||
return new ArrayOfDoublesSketchNoOpBufferAggregator(numberOfValues);
|
||||
return new NoopArrayOfDoublesSketchBufferAggregator(numberOfValues);
|
||||
}
|
||||
final List<BaseDoubleColumnValueSelector> valueSelectors = new ArrayList<>();
|
||||
for (final String column : metricColumns) {
|
||||
|
|
|
@ -23,12 +23,12 @@ import com.yahoo.sketches.tuple.ArrayOfDoublesSketch;
|
|||
import com.yahoo.sketches.tuple.ArrayOfDoublesUpdatableSketchBuilder;
|
||||
import org.apache.druid.query.aggregation.Aggregator;
|
||||
|
||||
public class ArrayOfDoublesSketchNoOpAggregator implements Aggregator
|
||||
public class NoopArrayOfDoublesSketchAggregator implements Aggregator
|
||||
{
|
||||
|
||||
private final ArrayOfDoublesSketch emptySketch;
|
||||
|
||||
public ArrayOfDoublesSketchNoOpAggregator(final int numberOfValues)
|
||||
public NoopArrayOfDoublesSketchAggregator(final int numberOfValues)
|
||||
{
|
||||
emptySketch = new ArrayOfDoublesUpdatableSketchBuilder().setNumberOfValues(numberOfValues).build().compact();
|
||||
}
|
|
@ -26,12 +26,12 @@ import org.apache.druid.query.monomorphicprocessing.RuntimeShapeInspector;
|
|||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
public class ArrayOfDoublesSketchNoOpBufferAggregator implements BufferAggregator
|
||||
public class NoopArrayOfDoublesSketchBufferAggregator implements BufferAggregator
|
||||
{
|
||||
|
||||
private final ArrayOfDoublesSketch emptySketch;
|
||||
|
||||
public ArrayOfDoublesSketchNoOpBufferAggregator(final int numberOfValues)
|
||||
public NoopArrayOfDoublesSketchBufferAggregator(final int numberOfValues)
|
||||
{
|
||||
emptySketch = new ArrayOfDoublesUpdatableSketchBuilder().setNumberOfValues(numberOfValues).build().compact();
|
||||
}
|
|
@ -94,7 +94,7 @@ public class BloomFilterAggregatorFactory extends AggregatorFactory
|
|||
BaseNullableColumnValueSelector selector = columnFactory.makeColumnValueSelector(field.getDimension());
|
||||
if (selector instanceof NilColumnValueSelector) {
|
||||
// BloomKFilter must be the same size so we cannot use a constant for the empty agg
|
||||
return new EmptyBloomFilterAggregator(filter);
|
||||
return new NoopBloomFilterAggregator(filter);
|
||||
}
|
||||
throw new IAE(
|
||||
"Cannot create bloom filter buffer aggregator for column selector type [%s]",
|
||||
|
@ -124,7 +124,7 @@ public class BloomFilterAggregatorFactory extends AggregatorFactory
|
|||
if (capabilities == null) {
|
||||
BaseNullableColumnValueSelector selector = columnFactory.makeColumnValueSelector(field.getDimension());
|
||||
if (selector instanceof NilColumnValueSelector) {
|
||||
return new EmptyBloomFilterBufferAggregator(maxNumEntries);
|
||||
return new NoopBloomFilterBufferAggregator(maxNumEntries);
|
||||
}
|
||||
throw new IAE(
|
||||
"Cannot create bloom filter buffer aggregator for column selector type [%s]",
|
||||
|
|
|
@ -22,9 +22,9 @@ package org.apache.druid.query.aggregation.bloom;
|
|||
import org.apache.druid.query.filter.BloomKFilter;
|
||||
import org.apache.druid.segment.NilColumnValueSelector;
|
||||
|
||||
public final class EmptyBloomFilterAggregator extends BaseBloomFilterAggregator<NilColumnValueSelector>
|
||||
public final class NoopBloomFilterAggregator extends BaseBloomFilterAggregator<NilColumnValueSelector>
|
||||
{
|
||||
EmptyBloomFilterAggregator(BloomKFilter collector)
|
||||
NoopBloomFilterAggregator(BloomKFilter collector)
|
||||
{
|
||||
super(NilColumnValueSelector.instance(), collector);
|
||||
}
|
|
@ -23,9 +23,9 @@ import org.apache.druid.segment.NilColumnValueSelector;
|
|||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
public final class EmptyBloomFilterBufferAggregator extends BaseBloomFilterBufferAggregator<NilColumnValueSelector>
|
||||
public final class NoopBloomFilterBufferAggregator extends BaseBloomFilterBufferAggregator<NilColumnValueSelector>
|
||||
{
|
||||
EmptyBloomFilterBufferAggregator(int maxNumEntries)
|
||||
NoopBloomFilterBufferAggregator(int maxNumEntries)
|
||||
{
|
||||
super(NilColumnValueSelector.instance(), maxNumEntries);
|
||||
}
|
|
@ -49,6 +49,12 @@ public final class NoopAggregator implements Aggregator
|
|||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getLong()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDouble()
|
||||
{
|
||||
|
@ -59,10 +65,4 @@ public final class NoopAggregator implements Aggregator
|
|||
public void close()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getLong()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,6 @@ public final class NoopBufferAggregator implements BufferAggregator
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long getLong(ByteBuffer buf, int position)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue