Class BaseChunkWriter.ValidityBuffer
java.lang.Object
io.deephaven.extensions.barrage.chunk.BaseChunkWriter.ValidityBuffer
- Enclosing class:
BaseChunkWriter<SOURCE_CHUNK_TYPE extends Chunk<Values>>
A bit per element, packed LSB-first into little-endian 64-bit words, as Arrow encodes a validity buffer: a set
bit marks a valid (non-null) element. Nulls are counted as the bits are appended, so a single traversal of the
row data yields both the field node's null count and the bytes of the validity buffer.
BooleanChunkWriter also uses this to pack its payload, which has the same shape, via
packed(int).
-
Constructor Summary
ConstructorsConstructorDescriptionValidityBuffer(int numElements) A validity bitmap, materialized only once a null is appended. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]bytes()Finalize and return the packed bytes; exactlygetValidityMapSerializationSizeFor(numElements)of them.intpacked(int numElements) A bit-packed buffer that is materialized up front, for a caller that needs the bits whatever the values turn out to be.voidsetNextAreNull(int numElements) AppendnumElementsnull entries; equivalent to that manysetNextIsNull(true)calls, but without visiting each element.voidsetNextIsNull(boolean isNull)
-
Constructor Details
-
ValidityBuffer
public ValidityBuffer(int numElements) A validity bitmap, materialized only once a null is appended. A column with no nulls sends no validity buffer at all, so asking such a buffer for itsbytes()is a caller bug and throws.
-
-
Method Details
-
packed
A bit-packed buffer that is materialized up front, for a caller that needs the bits whatever the values turn out to be.BooleanChunkWriterpacks its payload this way, where a set bit means TRUE rather than non-null and an all-TRUE column must still emit a full buffer.- Parameters:
numElements- the number of elements to be appended- Returns:
- a buffer whose
bytes()is always available
-
setNextIsNull
public void setNextIsNull(boolean isNull) -
setNextAreNull
public void setNextAreNull(int numElements) AppendnumElementsnull entries; equivalent to that manysetNextIsNull(true)calls, but without visiting each element.- Parameters:
numElements- the number of null entries to append
-
nullCount
public int nullCount() -
bytes
public byte[] bytes()Finalize and return the packed bytes; exactlygetValidityMapSerializationSizeFor(numElements)of them. No element may be appended afterwards.- Throws:
IllegalStateException- if nothing was ever materialized, i.e. no null was appended and the buffer was not created bypacked(int)
-