mirror of
https://github.com/apache/druid.git
synced 2025-02-17 23:46:30 +00:00
Merge pull request #565 from metamx/add-hll-test
test for correct HLL bytebuffer folding
This commit is contained in:
commit
c56f3fd1af
@ -305,6 +305,24 @@ public class HyperLogLogCollectorTest
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBufferSwap() throws Exception
|
||||
{
|
||||
ByteBuffer biggerOffset = makeCollectorBuffer(1, (byte) 0x00, 0x11);
|
||||
ByteBuffer smallerOffset = makeCollectorBuffer(0, (byte) 0x20, 0x00);
|
||||
|
||||
ByteBuffer buffer = ByteBuffer.allocate(HyperLogLogCollector.getLatestNumBytesForDenseStorage());
|
||||
HyperLogLogCollector collector = HyperLogLogCollector.makeCollector(buffer);
|
||||
|
||||
// make sure the original buffer gets modified
|
||||
collector.fold(biggerOffset);
|
||||
Assert.assertEquals(collector, HyperLogLogCollector.makeCollector(buffer));
|
||||
|
||||
// make sure the original buffer gets modified
|
||||
collector.fold(smallerOffset);
|
||||
Assert.assertEquals(collector, HyperLogLogCollector.makeCollector(buffer));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFoldWithArbitraryInitialPositions() throws Exception
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user