- All Known Implementing Classes:
BaseChunkWriter,BigDecimalChunkWriter,BooleanChunkWriter,ByteChunkWriter,CharChunkWriter,DictionaryChunkWriter,DoubleChunkWriter,FixedWidthChunkWriter,FixedWidthObjectChunkWriter,FloatChunkWriter,IntChunkWriter,ListChunkWriter,LongChunkWriter,MapChunkWriter,NullChunkWriter,RunEndEncodedChunkWriter,ShortChunkWriter,UnionChunkWriter,VarBinaryChunkWriter
The
ChunkWriter interface provides a mechanism for writing chunks of data into a structured format suitable
for transmission in Apache Arrow's columnar format. It enables efficient handling of chunked data, including support
for various data types and logical structures. This interface is part of the Deephaven Barrage extensions for
efficient data streaming and processing.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfacestatic classstatic classstatic interfaceCreator ofChunkWriterinstances.static final classstatic interface -
Method Summary
Modifier and TypeMethodDescriptiongetEmptyInputStream(@NotNull BarrageOptions options) Get an input stream representing the empty wire payload for this writer.default ChunkWriter.DrainableColumngetEmptyInputStream(@NotNull BarrageOptions options, @Nullable DictionaryWriterRegistry dictionaryRegistry) Get an input stream representing the empty wire payload for this writer, threading aDictionaryWriterRegistrydown to any dictionary-encoded writer nested within this writer, mirroringgetInputStream(Context, RowSet, BarrageOptions, DictionaryWriterRegistry).getInputStream(@NotNull ChunkWriter.Context context, @Nullable RowSet subset, @NotNull BarrageOptions options) Get an input stream optionally position-space filtered using the provided RowSet.default ChunkWriter.DrainableColumngetInputStream(@NotNull ChunkWriter.Context context, @Nullable RowSet subset, @NotNull BarrageOptions options, @Nullable DictionaryWriterRegistry dictionaryRegistry) Get an input stream, threading aDictionaryWriterRegistrydown to any dictionary-encoded writers nested within this writer (e.g.booleanmakeContext(SOURCE_CHUNK_TYPE chunk, long rowOffset) Create a context for the given chunk.
-
Method Details
-
makeContext
Create a context for the given chunk.- Parameters:
chunk- the chunk of data to be writtenrowOffset- the offset into the logical message potentially spread over multiple chunks- Returns:
- a context for the given chunk
-
getInputStream
ChunkWriter.DrainableColumn getInputStream(@NotNull @NotNull ChunkWriter.Context context, @Nullable @Nullable RowSet subset, @NotNull @NotNull BarrageOptions options) throws IOException Get an input stream optionally position-space filtered using the provided RowSet.- Parameters:
context- the chunk writer context holding the data to be drained to the clientsubset- if provided, is a position-space filter of source dataoptions- options for writing to the stream- Returns:
- a single-use DrainableColumn ready to be drained via grpc
- Throws:
IOException
-
getInputStream
default ChunkWriter.DrainableColumn getInputStream(@NotNull @NotNull ChunkWriter.Context context, @Nullable @Nullable RowSet subset, @NotNull @NotNull BarrageOptions options, @Nullable @Nullable DictionaryWriterRegistry dictionaryRegistry) throws IOException Get an input stream, threading aDictionaryWriterRegistrydown to any dictionary-encoded writers nested within this writer (e.g. thevalueschild of a run-end-encoded column). Writers that contain no dictionary encoding ignore the registry and behave identically togetInputStream(Context, RowSet, BarrageOptions).A
DictionaryChunkWriteruses the registry to obtain (and register) its per-idDictionaryWriterState, so that the enclosing message writer emits the correspondingDictionaryBatch. Composite writers forward the registry to their children.- Parameters:
context- the chunk writer context holding the data to be drained to the clientsubset- if provided, is a position-space filter of source dataoptions- options for writing to the streamdictionaryRegistry- the per-stream dictionary registry; may benullwhen the caller does not support dictionary encoding (a nested dictionary-encoded writer will then throw)- Returns:
- a single-use DrainableColumn ready to be drained via grpc
- Throws:
IOException
-
getEmptyInputStream
ChunkWriter.DrainableColumn getEmptyInputStream(@NotNull @NotNull BarrageOptions options) throws IOException Get an input stream representing the empty wire payload for this writer.- Parameters:
options- options for writing to the stream- Returns:
- a single-use DrainableColumn ready to be drained via grpc
- Throws:
IOException
-
getEmptyInputStream
default ChunkWriter.DrainableColumn getEmptyInputStream(@NotNull @NotNull BarrageOptions options, @Nullable @Nullable DictionaryWriterRegistry dictionaryRegistry) throws IOException Get an input stream representing the empty wire payload for this writer, threading aDictionaryWriterRegistrydown to any dictionary-encoded writer nested within this writer, mirroringgetInputStream(Context, RowSet, BarrageOptions, DictionaryWriterRegistry). This matters even for an empty payload: a dictionary-encoded column whose very first batch carries no rows (e.g. a freshly-created ticking table's initial, still-empty snapshot) must still register its id and emit an initial isDelta=false DictionaryBatch before any RecordBatch references it. Writers that contain no dictionary encoding ignore the registry and behave identically togetEmptyInputStream(BarrageOptions).- Parameters:
options- options for writing to the streamdictionaryRegistry- the per-stream dictionary registry; may benullwhen the caller does not support dictionary encoding (a nested dictionary-encoded writer will then throw)- Returns:
- a single-use DrainableColumn ready to be drained via grpc
- Throws:
IOException
-
isFieldNullable
boolean isFieldNullable()- Returns:
- whether the wire format for this writer might include a validity buffer
-