Class CharArrayExpansionKernel
java.lang.Object
io.deephaven.extensions.barrage.chunk.array.CharArrayExpansionKernel
- All Implemented Interfaces:
ArrayExpansionKernel<char[]>
,ExpansionKernel<char[]>
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<A extends Any>
WritableObjectChunk<char[],A> contract
(@NotNull Chunk<A> source, int sizePerElement, @Nullable IntChunk<ChunkPositions> offsets, @Nullable IntChunk<ChunkLengths> lengths, @Nullable WritableChunk<A> outChunk, int outOffset, int totalRows) Contracts a flattened chunk of elements (T
) back into a chunk of nested or multi-element data (T[]
orVector<T>
), using provided metadata (e.g., row offsets or lengths) to reconstruct the original structure.<A extends Any>
WritableChunk<A>expand
(@NotNull ObjectChunk<char[], A> source, int fixedSizeLength, @Nullable WritableIntChunk<ChunkPositions> offsetsDest) Expands a chunk of nested or multi-element data (T[]
orVector<T>
) into a flattened chunk of elements (T
), along with metadata describing the structure of the original data.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.deephaven.extensions.barrage.chunk.ExpansionKernel
computeSize
-
Field Details
-
INSTANCE
-
-
Constructor Details
-
CharArrayExpansionKernel
public CharArrayExpansionKernel()
-
-
Method Details
-
expand
public <A extends Any> WritableChunk<A> expand(@NotNull @NotNull ObjectChunk<char[], A> source, int fixedSizeLength, @Nullable @Nullable WritableIntChunk<ChunkPositions> offsetsDest) Description copied from interface:ExpansionKernel
Expands a chunk of nested or multi-element data (T[]
orVector<T>
) into a flattened chunk of elements (T
), along with metadata describing the structure of the original data.The expansion involves unrolling arrays, or
vectors
, or other multi-element types into a single contiguous chunk. The number of elements belonging to each original row is recorded inoffsetDest
, which allows reconstructing the original structure when needed.If a non-zero
fixedSizeLength
is provided, each row will be truncated or padded with nulls to match the fixed size. A negativefixedSizeLength
will pick elements from the end of the array/vector.- Specified by:
expand
in interfaceExpansionKernel<char[]>
- Type Parameters:
A
- The attribute type of the source chunk.- Parameters:
source
- The source chunk containing nested or multi-element data to expand.fixedSizeLength
- The fixed size for each row, or 0 for variable-length rows. A negative value will pick elements from the end.offsetsDest
- The destinationWritableIntChunk
to store row offsets, ornull
if not needed.- Returns:
- A flattened
WritableChunk
containing the expanded elements.
-
contract
public <A extends Any> WritableObjectChunk<char[],A> contract(@NotNull @NotNull Chunk<A> source, int sizePerElement, @Nullable @Nullable IntChunk<ChunkPositions> offsets, @Nullable @Nullable IntChunk<ChunkLengths> lengths, @Nullable @Nullable WritableChunk<A> outChunk, int outOffset, int totalRows) Description copied from interface:ExpansionKernel
Contracts a flattened chunk of elements (T
) back into a chunk of nested or multi-element data (T[]
orVector<T>
), using provided metadata (e.g., row offsets or lengths) to reconstruct the original structure.The contraction process supports multiple configurations:
- If
offsets
isnull
, each row is assumed to have a fixed size defined bysizePerElement
. - If
lengths
isnull
, each row's size is determined by differences between adjacent elements inoffsets
. An element's length is determined by subtracting its offset from the next offset, therefore offsets must contain one more element than the number of elements. - If both
offsets
andlengths
are provided,lengths
determines the row sizes.
- Specified by:
contract
in interfaceExpansionKernel<char[]>
- Type Parameters:
A
- The attribute type of the source chunk.- Parameters:
source
- The source chunk containing flattened data to contract.sizePerElement
- The fixed size for each row, or 0 for variable-length rows.offsets
- AnIntChunk
describing row start positions, ornull
.lengths
- AnIntChunk
describing row lengths, ornull
.outChunk
- A reusableWritableChunk
to store the contracted result, ornull
.outOffset
- The starting position for writing intooutChunk
.totalRows
- The total number of rows, or 0 if unknown.- Returns:
- A
WritableObjectChunk
containing the reconstructed nested or multi-element data.
- If
-