mirror of https://github.com/apache/druid.git
Replace HistoricalFloatColumnSelector with more generic HistoricalColumnSelector (#4796)
This commit is contained in:
parent
a17e48fe69
commit
b61248fdb1
|
@ -24,21 +24,21 @@ import io.druid.segment.data.IndexedInts;
|
||||||
import io.druid.segment.data.Offset;
|
import io.druid.segment.data.Offset;
|
||||||
import io.druid.segment.historical.HistoricalCursor;
|
import io.druid.segment.historical.HistoricalCursor;
|
||||||
import io.druid.segment.historical.HistoricalDimensionSelector;
|
import io.druid.segment.historical.HistoricalDimensionSelector;
|
||||||
import io.druid.segment.historical.HistoricalFloatColumnSelector;
|
import io.druid.segment.historical.HistoricalColumnSelector;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
|
||||||
public class Historical1SimpleDoubleAggPooledTopNScannerPrototype
|
public class Historical1SimpleDoubleAggPooledTopNScannerPrototype
|
||||||
implements Historical1AggPooledTopNScanner<
|
implements Historical1AggPooledTopNScanner<
|
||||||
HistoricalDimensionSelector,
|
HistoricalDimensionSelector,
|
||||||
HistoricalFloatColumnSelector,
|
HistoricalColumnSelector,
|
||||||
SimpleDoubleBufferAggregator
|
SimpleDoubleBufferAggregator
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public long scanAndAggregate(
|
public long scanAndAggregate(
|
||||||
HistoricalDimensionSelector dimensionSelector,
|
HistoricalDimensionSelector dimensionSelector,
|
||||||
HistoricalFloatColumnSelector metricSelector,
|
HistoricalColumnSelector metricSelector,
|
||||||
SimpleDoubleBufferAggregator aggregator,
|
SimpleDoubleBufferAggregator aggregator,
|
||||||
int aggregatorSize,
|
int aggregatorSize,
|
||||||
HistoricalCursor cursor,
|
HistoricalCursor cursor,
|
||||||
|
@ -52,7 +52,7 @@ public class Historical1SimpleDoubleAggPooledTopNScannerPrototype
|
||||||
int positionToAllocate = 0;
|
int positionToAllocate = 0;
|
||||||
while (offset.withinBounds() && !Thread.currentThread().isInterrupted()) {
|
while (offset.withinBounds() && !Thread.currentThread().isInterrupted()) {
|
||||||
int rowNum = offset.getOffset();
|
int rowNum = offset.getOffset();
|
||||||
double metric = metricSelector.get(rowNum);
|
double metric = metricSelector.getDouble(rowNum);
|
||||||
final IndexedInts dimValues = dimensionSelector.getRow(rowNum);
|
final IndexedInts dimValues = dimensionSelector.getRow(rowNum);
|
||||||
final int dimSize = dimValues.size();
|
final int dimSize = dimValues.size();
|
||||||
for (int i = 0; i < dimSize; i++) {
|
for (int i = 0; i < dimSize; i++) {
|
||||||
|
|
|
@ -22,7 +22,7 @@ package io.druid.query.topn;
|
||||||
import io.druid.query.aggregation.SimpleDoubleBufferAggregator;
|
import io.druid.query.aggregation.SimpleDoubleBufferAggregator;
|
||||||
import io.druid.segment.data.Offset;
|
import io.druid.segment.data.Offset;
|
||||||
import io.druid.segment.historical.HistoricalCursor;
|
import io.druid.segment.historical.HistoricalCursor;
|
||||||
import io.druid.segment.historical.HistoricalFloatColumnSelector;
|
import io.druid.segment.historical.HistoricalColumnSelector;
|
||||||
import io.druid.segment.historical.SingleValueHistoricalDimensionSelector;
|
import io.druid.segment.historical.SingleValueHistoricalDimensionSelector;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
@ -30,14 +30,14 @@ import java.nio.ByteBuffer;
|
||||||
public class HistoricalSingleValueDimSelector1SimpleDoubleAggPooledTopNScannerPrototype
|
public class HistoricalSingleValueDimSelector1SimpleDoubleAggPooledTopNScannerPrototype
|
||||||
implements Historical1AggPooledTopNScanner<
|
implements Historical1AggPooledTopNScanner<
|
||||||
SingleValueHistoricalDimensionSelector,
|
SingleValueHistoricalDimensionSelector,
|
||||||
HistoricalFloatColumnSelector,
|
HistoricalColumnSelector,
|
||||||
SimpleDoubleBufferAggregator
|
SimpleDoubleBufferAggregator
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public long scanAndAggregate(
|
public long scanAndAggregate(
|
||||||
SingleValueHistoricalDimensionSelector dimensionSelector,
|
SingleValueHistoricalDimensionSelector dimensionSelector,
|
||||||
HistoricalFloatColumnSelector metricSelector,
|
HistoricalColumnSelector metricSelector,
|
||||||
SimpleDoubleBufferAggregator aggregator,
|
SimpleDoubleBufferAggregator aggregator,
|
||||||
int aggregatorSize,
|
int aggregatorSize,
|
||||||
HistoricalCursor cursor,
|
HistoricalCursor cursor,
|
||||||
|
@ -54,10 +54,10 @@ public class HistoricalSingleValueDimSelector1SimpleDoubleAggPooledTopNScannerPr
|
||||||
int dimIndex = dimensionSelector.getRowValue(rowNum);
|
int dimIndex = dimensionSelector.getRowValue(rowNum);
|
||||||
int position = positions[dimIndex];
|
int position = positions[dimIndex];
|
||||||
if (position >= 0) {
|
if (position >= 0) {
|
||||||
aggregator.aggregate(resultsBuffer, position, metricSelector.get(rowNum));
|
aggregator.aggregate(resultsBuffer, position, metricSelector.getDouble(rowNum));
|
||||||
} else if (position == TopNAlgorithm.INIT_POSITION_VALUE) {
|
} else if (position == TopNAlgorithm.INIT_POSITION_VALUE) {
|
||||||
positions[dimIndex] = positionToAllocate;
|
positions[dimIndex] = positionToAllocate;
|
||||||
aggregator.putFirst(resultsBuffer, positionToAllocate, metricSelector.get(rowNum));
|
aggregator.putFirst(resultsBuffer, positionToAllocate, metricSelector.getDouble(rowNum));
|
||||||
positionToAllocate += aggregatorSize;
|
positionToAllocate += aggregatorSize;
|
||||||
}
|
}
|
||||||
processedRows++;
|
processedRows++;
|
||||||
|
|
|
@ -41,7 +41,7 @@ import io.druid.segment.data.IndexedInts;
|
||||||
import io.druid.segment.data.Offset;
|
import io.druid.segment.data.Offset;
|
||||||
import io.druid.segment.historical.HistoricalCursor;
|
import io.druid.segment.historical.HistoricalCursor;
|
||||||
import io.druid.segment.historical.HistoricalDimensionSelector;
|
import io.druid.segment.historical.HistoricalDimensionSelector;
|
||||||
import io.druid.segment.historical.HistoricalFloatColumnSelector;
|
import io.druid.segment.historical.HistoricalColumnSelector;
|
||||||
import io.druid.segment.historical.SingleValueHistoricalDimensionSelector;
|
import io.druid.segment.historical.SingleValueHistoricalDimensionSelector;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
@ -131,7 +131,7 @@ public class PooledTopNAlgorithm
|
||||||
final Cursor cursor = params.getCursor();
|
final Cursor cursor = params.getCursor();
|
||||||
if (cursor instanceof HistoricalCursor && aggregator instanceof SimpleDoubleBufferAggregator) {
|
if (cursor instanceof HistoricalCursor && aggregator instanceof SimpleDoubleBufferAggregator) {
|
||||||
if (params.getDimSelector() instanceof SingleValueHistoricalDimensionSelector &&
|
if (params.getDimSelector() instanceof SingleValueHistoricalDimensionSelector &&
|
||||||
((SimpleDoubleBufferAggregator) aggregator).getSelector() instanceof HistoricalFloatColumnSelector) {
|
((SimpleDoubleBufferAggregator) aggregator).getSelector() instanceof HistoricalColumnSelector) {
|
||||||
return scanAndAggregateHistorical1SimpleDoubleAgg(
|
return scanAndAggregateHistorical1SimpleDoubleAgg(
|
||||||
params,
|
params,
|
||||||
positions,
|
positions,
|
||||||
|
@ -152,7 +152,7 @@ public class PooledTopNAlgorithm
|
||||||
final Cursor cursor = params.getCursor();
|
final Cursor cursor = params.getCursor();
|
||||||
if (cursor instanceof HistoricalCursor && aggregator instanceof SimpleDoubleBufferAggregator) {
|
if (cursor instanceof HistoricalCursor && aggregator instanceof SimpleDoubleBufferAggregator) {
|
||||||
if (params.getDimSelector() instanceof HistoricalDimensionSelector &&
|
if (params.getDimSelector() instanceof HistoricalDimensionSelector &&
|
||||||
((SimpleDoubleBufferAggregator) aggregator).getSelector() instanceof HistoricalFloatColumnSelector) {
|
((SimpleDoubleBufferAggregator) aggregator).getSelector() instanceof HistoricalColumnSelector) {
|
||||||
return scanAndAggregateHistorical1SimpleDoubleAgg(
|
return scanAndAggregateHistorical1SimpleDoubleAgg(
|
||||||
params,
|
params,
|
||||||
positions,
|
positions,
|
||||||
|
|
|
@ -20,9 +20,9 @@
|
||||||
package io.druid.segment;
|
package io.druid.segment;
|
||||||
|
|
||||||
import io.druid.query.monomorphicprocessing.RuntimeShapeInspector;
|
import io.druid.query.monomorphicprocessing.RuntimeShapeInspector;
|
||||||
import io.druid.segment.historical.HistoricalFloatColumnSelector;
|
import io.druid.segment.historical.HistoricalColumnSelector;
|
||||||
|
|
||||||
public final class ZeroFloatColumnSelector implements HistoricalFloatColumnSelector
|
public final class ZeroFloatColumnSelector implements FloatColumnSelector, HistoricalColumnSelector
|
||||||
{
|
{
|
||||||
private static final ZeroFloatColumnSelector INSTANCE = new ZeroFloatColumnSelector();
|
private static final ZeroFloatColumnSelector INSTANCE = new ZeroFloatColumnSelector();
|
||||||
|
|
||||||
|
@ -43,9 +43,9 @@ public final class ZeroFloatColumnSelector implements HistoricalFloatColumnSelec
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float get(int offset)
|
public double getDouble(int offset)
|
||||||
{
|
{
|
||||||
return getFloat();
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -22,9 +22,9 @@ package io.druid.segment.column;
|
||||||
import io.druid.query.monomorphicprocessing.CalledFromHotLoop;
|
import io.druid.query.monomorphicprocessing.CalledFromHotLoop;
|
||||||
import io.druid.query.monomorphicprocessing.HotLoopCallee;
|
import io.druid.query.monomorphicprocessing.HotLoopCallee;
|
||||||
import io.druid.segment.DoubleColumnSelector;
|
import io.druid.segment.DoubleColumnSelector;
|
||||||
|
import io.druid.segment.FloatColumnSelector;
|
||||||
import io.druid.segment.LongColumnSelector;
|
import io.druid.segment.LongColumnSelector;
|
||||||
import io.druid.segment.data.ReadableOffset;
|
import io.druid.segment.data.ReadableOffset;
|
||||||
import io.druid.segment.historical.HistoricalFloatColumnSelector;
|
|
||||||
|
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ public interface GenericColumn extends HotLoopCallee, Closeable
|
||||||
|
|
||||||
@CalledFromHotLoop
|
@CalledFromHotLoop
|
||||||
float getFloatSingleValueRow(int rowNum);
|
float getFloatSingleValueRow(int rowNum);
|
||||||
HistoricalFloatColumnSelector makeFloatSingleValueRowSelector(ReadableOffset offset);
|
FloatColumnSelector makeFloatSingleValueRowSelector(ReadableOffset offset);
|
||||||
|
|
||||||
@CalledFromHotLoop
|
@CalledFromHotLoop
|
||||||
long getLongSingleValueRow(int rowNum);
|
long getLongSingleValueRow(int rowNum);
|
||||||
|
|
|
@ -21,10 +21,10 @@ package io.druid.segment.column;
|
||||||
|
|
||||||
import io.druid.query.monomorphicprocessing.RuntimeShapeInspector;
|
import io.druid.query.monomorphicprocessing.RuntimeShapeInspector;
|
||||||
import io.druid.segment.DoubleColumnSelector;
|
import io.druid.segment.DoubleColumnSelector;
|
||||||
|
import io.druid.segment.FloatColumnSelector;
|
||||||
import io.druid.segment.LongColumnSelector;
|
import io.druid.segment.LongColumnSelector;
|
||||||
import io.druid.segment.data.IndexedDoubles;
|
import io.druid.segment.data.IndexedDoubles;
|
||||||
import io.druid.segment.data.ReadableOffset;
|
import io.druid.segment.data.ReadableOffset;
|
||||||
import io.druid.segment.historical.HistoricalFloatColumnSelector;
|
|
||||||
|
|
||||||
|
|
||||||
public class IndexedDoublesGenericColumn implements GenericColumn
|
public class IndexedDoublesGenericColumn implements GenericColumn
|
||||||
|
@ -67,7 +67,7 @@ public class IndexedDoublesGenericColumn implements GenericColumn
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HistoricalFloatColumnSelector makeFloatSingleValueRowSelector(ReadableOffset offset)
|
public FloatColumnSelector makeFloatSingleValueRowSelector(ReadableOffset offset)
|
||||||
{
|
{
|
||||||
return column.makeFloatColumnSelector(offset);
|
return column.makeFloatColumnSelector(offset);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,10 +21,10 @@ package io.druid.segment.column;
|
||||||
|
|
||||||
import io.druid.query.monomorphicprocessing.RuntimeShapeInspector;
|
import io.druid.query.monomorphicprocessing.RuntimeShapeInspector;
|
||||||
import io.druid.segment.DoubleColumnSelector;
|
import io.druid.segment.DoubleColumnSelector;
|
||||||
|
import io.druid.segment.FloatColumnSelector;
|
||||||
import io.druid.segment.LongColumnSelector;
|
import io.druid.segment.LongColumnSelector;
|
||||||
import io.druid.segment.data.IndexedFloats;
|
import io.druid.segment.data.IndexedFloats;
|
||||||
import io.druid.segment.data.ReadableOffset;
|
import io.druid.segment.data.ReadableOffset;
|
||||||
import io.druid.segment.historical.HistoricalFloatColumnSelector;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
|
@ -68,7 +68,7 @@ public class IndexedFloatsGenericColumn implements GenericColumn
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HistoricalFloatColumnSelector makeFloatSingleValueRowSelector(ReadableOffset offset)
|
public FloatColumnSelector makeFloatSingleValueRowSelector(ReadableOffset offset)
|
||||||
{
|
{
|
||||||
return column.makeFloatColumnSelector(offset);
|
return column.makeFloatColumnSelector(offset);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,10 +21,10 @@ package io.druid.segment.column;
|
||||||
|
|
||||||
import io.druid.query.monomorphicprocessing.RuntimeShapeInspector;
|
import io.druid.query.monomorphicprocessing.RuntimeShapeInspector;
|
||||||
import io.druid.segment.DoubleColumnSelector;
|
import io.druid.segment.DoubleColumnSelector;
|
||||||
|
import io.druid.segment.FloatColumnSelector;
|
||||||
import io.druid.segment.LongColumnSelector;
|
import io.druid.segment.LongColumnSelector;
|
||||||
import io.druid.segment.data.IndexedLongs;
|
import io.druid.segment.data.IndexedLongs;
|
||||||
import io.druid.segment.data.ReadableOffset;
|
import io.druid.segment.data.ReadableOffset;
|
||||||
import io.druid.segment.historical.HistoricalFloatColumnSelector;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
|
@ -68,7 +68,7 @@ public class IndexedLongsGenericColumn implements GenericColumn
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HistoricalFloatColumnSelector makeFloatSingleValueRowSelector(ReadableOffset offset)
|
public FloatColumnSelector makeFloatSingleValueRowSelector(ReadableOffset offset)
|
||||||
{
|
{
|
||||||
return column.makeFloatColumnSelector(offset);
|
return column.makeFloatColumnSelector(offset);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,8 +21,9 @@ package io.druid.segment.data;
|
||||||
|
|
||||||
import io.druid.query.monomorphicprocessing.RuntimeShapeInspector;
|
import io.druid.query.monomorphicprocessing.RuntimeShapeInspector;
|
||||||
import io.druid.segment.DoubleColumnSelector;
|
import io.druid.segment.DoubleColumnSelector;
|
||||||
|
import io.druid.segment.FloatColumnSelector;
|
||||||
import io.druid.segment.LongColumnSelector;
|
import io.druid.segment.LongColumnSelector;
|
||||||
import io.druid.segment.historical.HistoricalFloatColumnSelector;
|
import io.druid.segment.historical.HistoricalColumnSelector;
|
||||||
|
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
|
|
||||||
|
@ -37,7 +38,7 @@ public interface IndexedDoubles extends Closeable
|
||||||
|
|
||||||
default DoubleColumnSelector makeDoubleColumnSelector(ReadableOffset offset)
|
default DoubleColumnSelector makeDoubleColumnSelector(ReadableOffset offset)
|
||||||
{
|
{
|
||||||
return new DoubleColumnSelector()
|
class HistoricalDoubleColumnSelector implements DoubleColumnSelector, HistoricalColumnSelector
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public double getDouble()
|
public double getDouble()
|
||||||
|
@ -45,43 +46,51 @@ public interface IndexedDoubles extends Closeable
|
||||||
return IndexedDoubles.this.get(offset.getOffset());
|
return IndexedDoubles.this.get(offset.getOffset());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getDouble(int offset)
|
||||||
|
{
|
||||||
|
return IndexedDoubles.this.get(offset);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void inspectRuntimeShape(RuntimeShapeInspector inspector)
|
public void inspectRuntimeShape(RuntimeShapeInspector inspector)
|
||||||
{
|
{
|
||||||
inspector.visit("indexed", IndexedDoubles.this);
|
inspector.visit("indexed", IndexedDoubles.this);
|
||||||
inspector.visit("offset", offset);
|
inspector.visit("offset", offset);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
return new HistoricalDoubleColumnSelector();
|
||||||
}
|
}
|
||||||
|
|
||||||
default HistoricalFloatColumnSelector makeFloatColumnSelector(ReadableOffset offset)
|
default FloatColumnSelector makeFloatColumnSelector(ReadableOffset offset)
|
||||||
{
|
{
|
||||||
return new HistoricalFloatColumnSelector()
|
class HistoricalFloatColumnSelector implements FloatColumnSelector, HistoricalColumnSelector
|
||||||
{
|
{
|
||||||
@Override
|
|
||||||
public float get(int offset)
|
|
||||||
{
|
|
||||||
return (float) IndexedDoubles.this.get(offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getFloat()
|
public float getFloat()
|
||||||
{
|
{
|
||||||
return (float) IndexedDoubles.this.get(offset.getOffset());
|
return (float) IndexedDoubles.this.get(offset.getOffset());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getDouble(int offset)
|
||||||
|
{
|
||||||
|
return IndexedDoubles.this.get(offset);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void inspectRuntimeShape(RuntimeShapeInspector inspector)
|
public void inspectRuntimeShape(RuntimeShapeInspector inspector)
|
||||||
{
|
{
|
||||||
inspector.visit("indexed", IndexedDoubles.this);
|
inspector.visit("indexed", IndexedDoubles.this);
|
||||||
inspector.visit("offset", offset);
|
inspector.visit("offset", offset);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
return new HistoricalFloatColumnSelector();
|
||||||
}
|
}
|
||||||
|
|
||||||
default LongColumnSelector makeLongColumnSelector(ReadableOffset offset)
|
default LongColumnSelector makeLongColumnSelector(ReadableOffset offset)
|
||||||
{
|
{
|
||||||
return new LongColumnSelector()
|
class HistoricalLongColumnSelector implements LongColumnSelector, HistoricalColumnSelector
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public long getLong()
|
public long getLong()
|
||||||
|
@ -89,13 +98,20 @@ public interface IndexedDoubles extends Closeable
|
||||||
return (long) IndexedDoubles.this.get(offset.getOffset());
|
return (long) IndexedDoubles.this.get(offset.getOffset());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getDouble(int offset)
|
||||||
|
{
|
||||||
|
return IndexedDoubles.this.get(offset);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void inspectRuntimeShape(RuntimeShapeInspector inspector)
|
public void inspectRuntimeShape(RuntimeShapeInspector inspector)
|
||||||
{
|
{
|
||||||
inspector.visit("indexed", IndexedDoubles.this);
|
inspector.visit("indexed", IndexedDoubles.this);
|
||||||
inspector.visit("offset", offset);
|
inspector.visit("offset", offset);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
return new HistoricalLongColumnSelector();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,9 @@ package io.druid.segment.data;
|
||||||
|
|
||||||
import io.druid.query.monomorphicprocessing.RuntimeShapeInspector;
|
import io.druid.query.monomorphicprocessing.RuntimeShapeInspector;
|
||||||
import io.druid.segment.DoubleColumnSelector;
|
import io.druid.segment.DoubleColumnSelector;
|
||||||
|
import io.druid.segment.FloatColumnSelector;
|
||||||
import io.druid.segment.LongColumnSelector;
|
import io.druid.segment.LongColumnSelector;
|
||||||
import io.druid.segment.historical.HistoricalFloatColumnSelector;
|
import io.druid.segment.historical.HistoricalColumnSelector;
|
||||||
|
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
|
|
||||||
|
@ -38,9 +39,9 @@ public interface IndexedFloats extends Closeable
|
||||||
@Override
|
@Override
|
||||||
void close();
|
void close();
|
||||||
|
|
||||||
default HistoricalFloatColumnSelector makeFloatColumnSelector(ReadableOffset offset)
|
default FloatColumnSelector makeFloatColumnSelector(ReadableOffset offset)
|
||||||
{
|
{
|
||||||
return new HistoricalFloatColumnSelector()
|
class HistoricalFloatColumnSelector implements FloatColumnSelector, HistoricalColumnSelector
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public float getFloat()
|
public float getFloat()
|
||||||
|
@ -49,7 +50,7 @@ public interface IndexedFloats extends Closeable
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float get(int offset)
|
public double getDouble(int offset)
|
||||||
{
|
{
|
||||||
return IndexedFloats.this.get(offset);
|
return IndexedFloats.this.get(offset);
|
||||||
}
|
}
|
||||||
|
@ -60,12 +61,13 @@ public interface IndexedFloats extends Closeable
|
||||||
inspector.visit("indexed", IndexedFloats.this);
|
inspector.visit("indexed", IndexedFloats.this);
|
||||||
inspector.visit("offset", offset);
|
inspector.visit("offset", offset);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
return new HistoricalFloatColumnSelector();
|
||||||
}
|
}
|
||||||
|
|
||||||
default DoubleColumnSelector makeDoubleColumnSelector(ReadableOffset offset)
|
default DoubleColumnSelector makeDoubleColumnSelector(ReadableOffset offset)
|
||||||
{
|
{
|
||||||
return new DoubleColumnSelector()
|
class HistoricalDoubleColumnSelector implements DoubleColumnSelector, HistoricalColumnSelector
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public double getDouble()
|
public double getDouble()
|
||||||
|
@ -73,18 +75,25 @@ public interface IndexedFloats extends Closeable
|
||||||
return IndexedFloats.this.get(offset.getOffset());
|
return IndexedFloats.this.get(offset.getOffset());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getDouble(int offset)
|
||||||
|
{
|
||||||
|
return IndexedFloats.this.get(offset);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void inspectRuntimeShape(RuntimeShapeInspector inspector)
|
public void inspectRuntimeShape(RuntimeShapeInspector inspector)
|
||||||
{
|
{
|
||||||
inspector.visit("indexed", IndexedFloats.this);
|
inspector.visit("indexed", IndexedFloats.this);
|
||||||
inspector.visit("offset", offset);
|
inspector.visit("offset", offset);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
return new HistoricalDoubleColumnSelector();
|
||||||
}
|
}
|
||||||
|
|
||||||
default LongColumnSelector makeLongColumnSelector(ReadableOffset offset)
|
default LongColumnSelector makeLongColumnSelector(ReadableOffset offset)
|
||||||
{
|
{
|
||||||
return new LongColumnSelector()
|
class HistoricalLongColumnSelector implements LongColumnSelector, HistoricalColumnSelector
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public long getLong()
|
public long getLong()
|
||||||
|
@ -92,12 +101,19 @@ public interface IndexedFloats extends Closeable
|
||||||
return (long) IndexedFloats.this.get(offset.getOffset());
|
return (long) IndexedFloats.this.get(offset.getOffset());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getDouble(int offset)
|
||||||
|
{
|
||||||
|
return IndexedFloats.this.get(offset);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void inspectRuntimeShape(RuntimeShapeInspector inspector)
|
public void inspectRuntimeShape(RuntimeShapeInspector inspector)
|
||||||
{
|
{
|
||||||
inspector.visit("indexed", IndexedFloats.this);
|
inspector.visit("indexed", IndexedFloats.this);
|
||||||
inspector.visit("offset", offset);
|
inspector.visit("offset", offset);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
return new HistoricalLongColumnSelector();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,8 +21,9 @@ package io.druid.segment.data;
|
||||||
|
|
||||||
import io.druid.query.monomorphicprocessing.RuntimeShapeInspector;
|
import io.druid.query.monomorphicprocessing.RuntimeShapeInspector;
|
||||||
import io.druid.segment.DoubleColumnSelector;
|
import io.druid.segment.DoubleColumnSelector;
|
||||||
|
import io.druid.segment.FloatColumnSelector;
|
||||||
import io.druid.segment.LongColumnSelector;
|
import io.druid.segment.LongColumnSelector;
|
||||||
import io.druid.segment.historical.HistoricalFloatColumnSelector;
|
import io.druid.segment.historical.HistoricalColumnSelector;
|
||||||
|
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
|
|
||||||
|
@ -40,7 +41,7 @@ public interface IndexedLongs extends Closeable
|
||||||
|
|
||||||
default LongColumnSelector makeLongColumnSelector(ReadableOffset offset)
|
default LongColumnSelector makeLongColumnSelector(ReadableOffset offset)
|
||||||
{
|
{
|
||||||
return new LongColumnSelector()
|
class HistoricalLongColumnSelector implements LongColumnSelector, HistoricalColumnSelector
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public long getLong()
|
public long getLong()
|
||||||
|
@ -48,18 +49,25 @@ public interface IndexedLongs extends Closeable
|
||||||
return IndexedLongs.this.get(offset.getOffset());
|
return IndexedLongs.this.get(offset.getOffset());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getDouble(int offset)
|
||||||
|
{
|
||||||
|
return IndexedLongs.this.get(offset);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void inspectRuntimeShape(RuntimeShapeInspector inspector)
|
public void inspectRuntimeShape(RuntimeShapeInspector inspector)
|
||||||
{
|
{
|
||||||
inspector.visit("indexed", IndexedLongs.this);
|
inspector.visit("indexed", IndexedLongs.this);
|
||||||
inspector.visit("offset", offset);
|
inspector.visit("offset", offset);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
return new HistoricalLongColumnSelector();
|
||||||
}
|
}
|
||||||
|
|
||||||
default HistoricalFloatColumnSelector makeFloatColumnSelector(ReadableOffset offset)
|
default FloatColumnSelector makeFloatColumnSelector(ReadableOffset offset)
|
||||||
{
|
{
|
||||||
return new HistoricalFloatColumnSelector()
|
class HistoricalFloatColumnSelector implements FloatColumnSelector, HistoricalColumnSelector
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public float getFloat()
|
public float getFloat()
|
||||||
|
@ -68,9 +76,9 @@ public interface IndexedLongs extends Closeable
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float get(int offset)
|
public double getDouble(int offset)
|
||||||
{
|
{
|
||||||
return (float) IndexedLongs.this.get(offset);
|
return IndexedLongs.this.get(offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -79,12 +87,13 @@ public interface IndexedLongs extends Closeable
|
||||||
inspector.visit("indexed", IndexedLongs.this);
|
inspector.visit("indexed", IndexedLongs.this);
|
||||||
inspector.visit("offset", offset);
|
inspector.visit("offset", offset);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
return new HistoricalFloatColumnSelector();
|
||||||
}
|
}
|
||||||
|
|
||||||
default DoubleColumnSelector makeDoubleColumnSelector(ReadableOffset offset)
|
default DoubleColumnSelector makeDoubleColumnSelector(ReadableOffset offset)
|
||||||
{
|
{
|
||||||
return new DoubleColumnSelector()
|
class HistoricalDoubleColumnSelector implements DoubleColumnSelector, HistoricalColumnSelector
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public double getDouble()
|
public double getDouble()
|
||||||
|
@ -92,12 +101,19 @@ public interface IndexedLongs extends Closeable
|
||||||
return (double) IndexedLongs.this.get(offset.getOffset());
|
return (double) IndexedLongs.this.get(offset.getOffset());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getDouble(int offset)
|
||||||
|
{
|
||||||
|
return IndexedLongs.this.get(offset);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void inspectRuntimeShape(RuntimeShapeInspector inspector)
|
public void inspectRuntimeShape(RuntimeShapeInspector inspector)
|
||||||
{
|
{
|
||||||
inspector.visit("indexed", IndexedLongs.this);
|
inspector.visit("indexed", IndexedLongs.this);
|
||||||
inspector.visit("offset", offset);
|
inspector.visit("offset", offset);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
return new HistoricalDoubleColumnSelector();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,10 +20,10 @@
|
||||||
package io.druid.segment.historical;
|
package io.druid.segment.historical;
|
||||||
|
|
||||||
import io.druid.query.monomorphicprocessing.CalledFromHotLoop;
|
import io.druid.query.monomorphicprocessing.CalledFromHotLoop;
|
||||||
import io.druid.segment.FloatColumnSelector;
|
import io.druid.segment.ColumnValueSelector;
|
||||||
|
|
||||||
public interface HistoricalFloatColumnSelector extends FloatColumnSelector
|
public interface HistoricalColumnSelector extends ColumnValueSelector
|
||||||
{
|
{
|
||||||
@CalledFromHotLoop
|
@CalledFromHotLoop
|
||||||
float get(int offset);
|
double getDouble(int offset);
|
||||||
}
|
}
|
Loading…
Reference in New Issue