Class LocalDictionaryWriterState
java.lang.Object
io.deephaven.extensions.barrage.chunk.LocalDictionaryWriterState
- All Implemented Interfaces:
DictionaryWriterState
DictionaryWriterState implementation for viewport subscriptions and snapshots. A single
DictionaryWriterValueMap holds all distinct values in insertion order; deltaStartOffset marks the
boundary between values already flushed to the subscriber and values that still need to be sent.
Thread-safety: not thread-safe; single-threaded barrage stream serialization is assumed.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NotNull WritableChunk<Values> Builds and returns a typed chunk containing the current delta values (values added since the lastDictionaryWriterState.resetDelta()call, or all values if this is the first batch for this subscriber).voidfillIndexChunk(@NotNull Chunk<Values> source, @Nullable RowSet subset, @NotNull BarrageOptions options, @NotNull WritableIntChunk<Values> out) Fillsoutwith one dictionary index per logical row insource/subset.longbooleanhasDelta()Returnstrueif a DictionaryBatch message needs to be emitted before the current RecordBatch — either because this is the first batch for this subscriber (isDelta=false) or because new values have been added since the last reset.booleanvoidreset()Resets the dictionary to an empty state, as if no values had ever been seen.voidAdvances the delta boundary after a DictionaryBatch has been successfully emitted.intCurrent number of distinct values in the dictionary (resets to zero afterDictionaryWriterState.reset()).
-
Constructor Details
-
LocalDictionaryWriterState
-
-
Method Details
-
getDictId
public long getDictId()- Specified by:
getDictIdin interfaceDictionaryWriterState
-
fillIndexChunk
public void fillIndexChunk(@NotNull @NotNull Chunk<Values> source, @Nullable @Nullable RowSet subset, @NotNull @NotNull BarrageOptions options, @NotNull @NotNull WritableIntChunk<Values> out) Description copied from interface:DictionaryWriterStateFillsoutwith one dictionary index per logical row insource/subset. Null rows (in non-deephaven-nulls mode) produceQueryConstants.NULL_INT; non-null rows produce a non-negative dictionary index, registering new values as needed.- Specified by:
fillIndexChunkin interfaceDictionaryWriterState- Parameters:
source- the source chunk containing column valuessubset- row positions withinsourceto include;nullmeans all rowsoptions- barrage serialization options (e.g.useDeephavenNulls)out- pre-sized output chunk to fill with dictionary indices
-
hasDelta
public boolean hasDelta()Description copied from interface:DictionaryWriterStateReturnstrueif a DictionaryBatch message needs to be emitted before the current RecordBatch — either because this is the first batch for this subscriber (isDelta=false) or because new values have been added since the last reset.- Specified by:
hasDeltain interfaceDictionaryWriterState
-
needsFullBatch
public boolean needsFullBatch()- Specified by:
needsFullBatchin interfaceDictionaryWriterState
-
buildDeltaChunk
Description copied from interface:DictionaryWriterStateBuilds and returns a typed chunk containing the current delta values (values added since the lastDictionaryWriterState.resetDelta()call, or all values if this is the first batch for this subscriber). The returned chunk is owned by the caller and must be closed when no longer needed.- Specified by:
buildDeltaChunkin interfaceDictionaryWriterState
-
resetDelta
public void resetDelta()Description copied from interface:DictionaryWriterStateAdvances the delta boundary after a DictionaryBatch has been successfully emitted. UnlikeDictionaryWriterState.reset(), this does not discard the accumulated value-to-index mapping — it only moves the boundary so that already-sent values are excluded from future delta batches. The client's cached dictionary remains valid after this call.- Specified by:
resetDeltain interfaceDictionaryWriterState
-
totalSize
public int totalSize()Description copied from interface:DictionaryWriterStateCurrent number of distinct values in the dictionary (resets to zero afterDictionaryWriterState.reset()).- Specified by:
totalSizein interfaceDictionaryWriterState
-
reset
public void reset()Description copied from interface:DictionaryWriterStateResets the dictionary to an empty state, as if no values had ever been seen. The next DictionaryBatch emitted will beisDelta=falsewith only the values encountered in the next batch. Call this when the cumulative dictionary size exceeds the live row count and compaction is needed.- Specified by:
resetin interfaceDictionaryWriterState
-