Class FloatVectorExpansionKernel

java.lang.Object
io.deephaven.extensions.barrage.chunk.vector.FloatVectorExpansionKernel
All Implemented Interfaces:
ExpansionKernel<FloatVector>, VectorExpansionKernel<FloatVector>

public class FloatVectorExpansionKernel extends Object implements VectorExpansionKernel<FloatVector>
  • Field Details

  • Constructor Details

    • FloatVectorExpansionKernel

      public FloatVectorExpansionKernel()
  • Method Details

    • expand

      public <A extends Any> WritableChunk<A> expand(@NotNull @NotNull ObjectChunk<FloatVector,A> source, int fixedSizeLength, @Nullable @Nullable WritableIntChunk<ChunkPositions> offsetsDest)
      Description copied from interface: ExpansionKernel
      Expands a chunk of nested or multi-element data (T[] or Vector<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 in offsetDest, 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 negative fixedSizeLength will pick elements from the end of the array/vector.

      Specified by:
      expand in interface ExpansionKernel<FloatVector>
      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 destination WritableIntChunk to store row offsets, or null if not needed.
      Returns:
      A flattened WritableChunk containing the expanded elements.
    • contract

      public <A extends Any> WritableObjectChunk<FloatVector,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[] or Vector<T>), using provided metadata (e.g., row offsets or lengths) to reconstruct the original structure.

      The contraction process supports multiple configurations:

      • If offsets is null, each row is assumed to have a fixed size defined by sizePerElement.
      • If lengths is null, each row's size is determined by differences between adjacent elements in offsets. 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 and lengths are provided, lengths determines the row sizes.
      Specified by:
      contract in interface ExpansionKernel<FloatVector>
      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 - An IntChunk describing row start positions, or null.
      lengths - An IntChunk describing row lengths, or null.
      outChunk - A reusable WritableChunk to store the contracted result, or null.
      outOffset - The starting position for writing into outChunk.
      totalRows - The total number of rows, or 0 if unknown.
      Returns:
      A WritableObjectChunk containing the reconstructed nested or multi-element data.