mirror of https://github.com/apache/druid.git
remove HLL version specific code outside of HyperLogLogCollector
This commit is contained in:
parent
cd340aa314
commit
7dc0e9f1a9
|
@ -37,12 +37,12 @@ public class HLLCV0 extends HyperLogLogCollector
|
||||||
|
|
||||||
private static final ByteBuffer defaultStorageBuffer = ByteBuffer.wrap(new byte[]{0, 0, 0}).asReadOnlyBuffer();
|
private static final ByteBuffer defaultStorageBuffer = ByteBuffer.wrap(new byte[]{0, 0, 0}).asReadOnlyBuffer();
|
||||||
|
|
||||||
public HLLCV0()
|
protected HLLCV0()
|
||||||
{
|
{
|
||||||
super(defaultStorageBuffer);
|
super(defaultStorageBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public HLLCV0(ByteBuffer buffer)
|
protected HLLCV0(ByteBuffer buffer)
|
||||||
{
|
{
|
||||||
super(buffer);
|
super(buffer);
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,12 +44,12 @@ public class HLLCV1 extends HyperLogLogCollector
|
||||||
private static final ByteBuffer defaultStorageBuffer = ByteBuffer.wrap(new byte[]{VERSION, 0, 0, 0, 0, 0, 0})
|
private static final ByteBuffer defaultStorageBuffer = ByteBuffer.wrap(new byte[]{VERSION, 0, 0, 0, 0, 0, 0})
|
||||||
.asReadOnlyBuffer();
|
.asReadOnlyBuffer();
|
||||||
|
|
||||||
public HLLCV1()
|
protected HLLCV1()
|
||||||
{
|
{
|
||||||
super(defaultStorageBuffer);
|
super(defaultStorageBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public HLLCV1(ByteBuffer buffer)
|
protected HLLCV1(ByteBuffer buffer)
|
||||||
{
|
{
|
||||||
super(buffer);
|
super(buffer);
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,9 +121,7 @@ public class HyperUniquesSerde extends ComplexMetricSerde
|
||||||
public HyperLogLogCollector fromByteBuffer(ByteBuffer buffer, int numBytes)
|
public HyperLogLogCollector fromByteBuffer(ByteBuffer buffer, int numBytes)
|
||||||
{
|
{
|
||||||
buffer.limit(buffer.position() + numBytes);
|
buffer.limit(buffer.position() + numBytes);
|
||||||
|
return HyperLogLogCollector.makeCollector(buffer);
|
||||||
int remaining = buffer.remaining();
|
|
||||||
return (remaining % 3 == 0 || remaining == 1027) ? new HLLCV0(buffer) : new HLLCV1(buffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue