Interface VectorGrouper

All Superinterfaces:
AutoCloseable, Closeable
All Known Implementing Classes:
BufferArrayGrouper, HashVectorGrouper

public interface VectorGrouper extends Closeable
Like a Grouper, but vectorized. Keys are always memory regions, so there is no generic type parameter KeyType.

This interface is designed such that an implementation can implement both Grouper and VectorGrouper. Of course, it would generally only make sense for a particular instance to be called with one set of functionality or the other.

  • Method Summary

    Modifier and Type
    Method
    Description
    aggregateVector(org.apache.datasketches.memory.Memory keySpace, int startRow, int endRow)
    Aggregate the current vector of rows from "startRow" to "endRow" using the provided keys.
    void
    Close the grouper and release associated resources.
    void
    initVectorized(int maxVectorSize)
    Initialize the grouper.
    Iterate through entry buckets.
    void
    Reset the grouper to its initial state.
  • Method Details

    • initVectorized

      void initVectorized(int maxVectorSize)
      Initialize the grouper. This method needs to be called before calling aggregateVector(org.apache.datasketches.memory.Memory, int, int).
    • aggregateVector

      AggregateResult aggregateVector(org.apache.datasketches.memory.Memory keySpace, int startRow, int endRow)
      Aggregate the current vector of rows from "startRow" to "endRow" using the provided keys.
      Parameters:
      keySpace - array holding keys, chunked into ints. First (endRow - startRow) keys must be valid.
      startRow - row to start at (inclusive).
      endRow - row to end at (exclusive).
      Returns:
      result that indicates how many keys were aggregated (may be partial due to resource limits)
    • reset

      void reset()
      Reset the grouper to its initial state.
    • close

      void close()
      Close the grouper and release associated resources.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
    • iterator

      Iterate through entry buckets. Each bucket's key is a MemoryPointer object in native byte order.

      After you are done with the iterator returned by this method, you should either call close() (if you are done with the VectorGrouper) or reset() (if you want to reuse it).

      Callers must process and discard the returned Grouper.Entrys immediately, because objects may be reused.

      Returns:
      entry iterator