Search in sources :

Example 1 with MemoryRegion

use of com.yahoo.memory.MemoryRegion in project druid by druid-io.

the class SketchBufferAggregator method getUnion.

//Note that this is not threadsafe and I don't think it needs to be
private Union getUnion(ByteBuffer buf, int position) {
    Union union = unions.get(position);
    if (union == null) {
        Memory mem = new MemoryRegion(nm, position, maxIntermediateSize);
        union = (Union) SetOperation.wrap(mem);
        unions.put(position, union);
    }
    return union;
}
Also used : Memory(com.yahoo.memory.Memory) NativeMemory(com.yahoo.memory.NativeMemory) MemoryRegion(com.yahoo.memory.MemoryRegion) Union(com.yahoo.sketches.theta.Union)

Example 2 with MemoryRegion

use of com.yahoo.memory.MemoryRegion in project druid by druid-io.

the class SketchBufferAggregator method init.

@Override
public void init(ByteBuffer buf, int position) {
    if (nm == null) {
        nm = new NativeMemory(buf);
    }
    Memory mem = new MemoryRegion(nm, position, maxIntermediateSize);
    unions.put(position, (Union) SetOperation.builder().initMemory(mem).build(size, Family.UNION));
}
Also used : NativeMemory(com.yahoo.memory.NativeMemory) Memory(com.yahoo.memory.Memory) NativeMemory(com.yahoo.memory.NativeMemory) MemoryRegion(com.yahoo.memory.MemoryRegion)

Aggregations

Memory (com.yahoo.memory.Memory)2 MemoryRegion (com.yahoo.memory.MemoryRegion)2 NativeMemory (com.yahoo.memory.NativeMemory)2 Union (com.yahoo.sketches.theta.Union)1