diff --git a/processing/src/main/java/io/druid/query/aggregation/hyperloglog/HLLCV0.java b/processing/src/main/java/io/druid/query/aggregation/hyperloglog/HLLCV0.java index 281a19fc9ef..f58723f5d3d 100644 --- a/processing/src/main/java/io/druid/query/aggregation/hyperloglog/HLLCV0.java +++ b/processing/src/main/java/io/druid/query/aggregation/hyperloglog/HLLCV0.java @@ -37,12 +37,12 @@ public class HLLCV0 extends HyperLogLogCollector private static final ByteBuffer defaultStorageBuffer = ByteBuffer.wrap(new byte[]{0, 0, 0}).asReadOnlyBuffer(); - public HLLCV0() + protected HLLCV0() { super(defaultStorageBuffer); } - public HLLCV0(ByteBuffer buffer) + protected HLLCV0(ByteBuffer buffer) { super(buffer); } @@ -149,4 +149,4 @@ public class HLLCV0 extends HyperLogLogCollector { return buffer.position() + HEADER_NUM_BYTES; } -} \ No newline at end of file +} diff --git a/processing/src/main/java/io/druid/query/aggregation/hyperloglog/HLLCV1.java b/processing/src/main/java/io/druid/query/aggregation/hyperloglog/HLLCV1.java index 3080275ec82..d0f28370332 100644 --- a/processing/src/main/java/io/druid/query/aggregation/hyperloglog/HLLCV1.java +++ b/processing/src/main/java/io/druid/query/aggregation/hyperloglog/HLLCV1.java @@ -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}) .asReadOnlyBuffer(); - public HLLCV1() + protected HLLCV1() { super(defaultStorageBuffer); } - public HLLCV1(ByteBuffer buffer) + protected HLLCV1(ByteBuffer buffer) { super(buffer); } diff --git a/processing/src/main/java/io/druid/query/aggregation/hyperloglog/HyperUniquesSerde.java b/processing/src/main/java/io/druid/query/aggregation/hyperloglog/HyperUniquesSerde.java index b720184fc9e..da7d2fd7aaa 100644 --- a/processing/src/main/java/io/druid/query/aggregation/hyperloglog/HyperUniquesSerde.java +++ b/processing/src/main/java/io/druid/query/aggregation/hyperloglog/HyperUniquesSerde.java @@ -121,9 +121,7 @@ public class HyperUniquesSerde extends ComplexMetricSerde public HyperLogLogCollector fromByteBuffer(ByteBuffer buffer, int numBytes) { buffer.limit(buffer.position() + numBytes); - - int remaining = buffer.remaining(); - return (remaining % 3 == 0 || remaining == 1027) ? new HLLCV0(buffer) : new HLLCV1(buffer); + return HyperLogLogCollector.makeCollector(buffer); } @Override