mirror of https://github.com/apache/druid.git
folding into direct buffers is faster
This commit is contained in:
parent
83ac1d323e
commit
c92fd6f45d
|
@ -66,10 +66,11 @@ public class HyperUniquesBufferAggregator implements BufferAggregator
|
||||||
@Override
|
@Override
|
||||||
public Object get(ByteBuffer buf, int position)
|
public Object get(ByteBuffer buf, int position)
|
||||||
{
|
{
|
||||||
ByteBuffer dataCopyBuffer = ByteBuffer.allocate(HyperLogLogCollector.getLatestNumBytesForDenseStorage());
|
ByteBuffer dataCopyBuffer = ByteBuffer.allocateDirect(HyperLogLogCollector.getLatestNumBytesForDenseStorage());
|
||||||
ByteBuffer mutationBuffer = buf.duplicate();
|
ByteBuffer mutationBuffer = buf.duplicate();
|
||||||
mutationBuffer.position(position);
|
mutationBuffer.position(position);
|
||||||
mutationBuffer.get(dataCopyBuffer.array());
|
dataCopyBuffer.put(mutationBuffer);
|
||||||
|
dataCopyBuffer.rewind();
|
||||||
return HyperLogLogCollector.makeCollector(dataCopyBuffer);
|
return HyperLogLogCollector.makeCollector(dataCopyBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue