@Override public void clear() { vector.clear(); }
@Override public void toNullable(ValueVector nullableVector) { exchange(nullableVector); clear(); }
public void transferTo(NullableUInt4Vector target){ bits.transferTo(target.bits); values.transferTo(target.values); clear(); }
@Override public DrillBuf[] getBuffers(boolean clear) { final DrillBuf[] buffers = ObjectArrays.concat(bits.getBuffers(false), values.getBuffers(false), DrillBuf.class); if (clear) { for (final DrillBuf buffer:buffers) { buffer.retain(1); } clear(); } return buffers; }
public UInt4Vector convertToRequiredVector(){ UInt4Vector v = new UInt4Vector(getField().getOtherNullableVersion(), allocator); if (v.data != null) { v.data.release(1); } v.data = values.data; v.data.retain(1); clear(); return v; }
@Override public void allocateNew(int valueCount) { try { values.allocateNew(valueCount); bits.allocateNew(valueCount); } catch(OutOfMemoryException e) { clear(); throw e; } bits.zeroVector(); mutator.reset(); accessor.reset(); }
@Override public boolean allocateNewSafe() { /* Boolean to keep track if all the memory allocations were successful * Used in the case of composite vectors when we need to allocate multiple * buffers for multiple vectors. If one of the allocations failed we need to * clear all the memory that we allocated */ boolean success = false; try { success = values.allocateNewSafe() && bits.allocateNewSafe(); } finally { if (!success) { clear(); } } bits.zeroVector(); mutator.reset(); accessor.reset(); return success; }
@Override public void load(SerializedField metadata, DrillBuf buffer) { clear(); // the bits vector is the first child (the order in which the children are added in getMetadataBuilder is significant) final SerializedField bitsField = metadata.getChild(0); bits.load(bitsField, buffer); final int capacity = buffer.capacity(); final int bitsLength = bitsField.getBufferLength(); final SerializedField valuesField = metadata.getChild(1); values.load(valuesField, buffer.slice(bitsLength, capacity - bitsLength)); }
public void fromNotNullable(UInt4Vector srce) { clear(); final int valueCount = srce.getAccessor().getValueCount(); // Create a new bits vector, all values non-null fillBitsVector(getBitsVector(), valueCount); // Swap the data portion getValuesVector().exchange(srce); setValueCount(valueCount); } }
@Override public void clear() { vector.clear(); }
@Override public void toNullable(ValueVector nullableVector) { exchange(nullableVector); clear(); }
public void transferTo(NullableUInt4Vector target){ bits.transferTo(target.bits); values.transferTo(target.values); clear(); }
@Override public DrillBuf[] getBuffers(boolean clear) { final DrillBuf[] buffers = ObjectArrays.concat(bits.getBuffers(false), values.getBuffers(false), DrillBuf.class); if (clear) { for (final DrillBuf buffer:buffers) { buffer.retain(1); } clear(); } return buffers; }
public UInt4Vector convertToRequiredVector(){ UInt4Vector v = new UInt4Vector(getField().getOtherNullableVersion(), allocator); if (v.data != null) { v.data.release(1); } v.data = values.data; v.data.retain(1); clear(); return v; }
@Override public void allocateNew(int valueCount) { try { values.allocateNew(valueCount); bits.allocateNew(valueCount); } catch(OutOfMemoryException e) { clear(); throw e; } bits.zeroVector(); mutator.reset(); accessor.reset(); }
@Override public boolean allocateNewSafe() { /* Boolean to keep track if all the memory allocations were successful * Used in the case of composite vectors when we need to allocate multiple * buffers for multiple vectors. If one of the allocations failed we need to * clear all the memory that we allocated */ boolean success = false; try { success = values.allocateNewSafe() && bits.allocateNewSafe(); } finally { if (!success) { clear(); } } bits.zeroVector(); mutator.reset(); accessor.reset(); return success; }
public void fromNotNullable(UInt4Vector srce) { clear(); final int valueCount = srce.getAccessor().getValueCount(); // Create a new bits vector, all values non-null fillBitsVector(getBitsVector(), valueCount); // Swap the data portion getValuesVector().exchange(srce); setValueCount(valueCount); } }
@Override public void load(SerializedField metadata, DrillBuf buffer) { clear(); // the bits vector is the first child (the order in which the children are added in getMetadataBuilder is significant) final SerializedField bitsField = metadata.getChild(0); bits.load(bitsField, buffer); final int capacity = buffer.capacity(); final int bitsLength = bitsField.getBufferLength(); final SerializedField valuesField = metadata.getChild(1); values.load(valuesField, buffer.slice(bitsLength, capacity - bitsLength)); }