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, waitMethods 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:ExpansionKernelExpands 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
fixedSizeLengthis provided, each row will be truncated or padded with nulls to match the fixed size. A negativefixedSizeLengthwill pick elements from the end of the array/vector.- Specified by:
expandin 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.offsetsDest- The destinationWritableIntChunkto store row offsets, ornullif not needed.- Returns:
- A flattened
WritableChunkcontaining 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:ExpansionKernelContracts 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
offsetsisnull, each row is assumed to have a fixed size defined bysizePerElement. - If
lengthsisnull, 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
offsetsandlengthsare provided,lengthsdetermines the row sizes.
- Specified by:
contractin 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- AnIntChunkdescribing row start positions, ornull.lengths- AnIntChunkdescribing row lengths, ornull.outChunk- A reusableWritableChunkto store the contracted result, ornull.outOffset- The starting position for writing intooutChunk.totalRows- The total number of rows, or 0 if unknown.- Returns:
- A
WritableObjectChunkcontaining the reconstructed nested or multi-element data.
- If
-