Class GroupingUtils

java.lang.Object
io.deephaven.engine.table.impl.GroupingUtils

public class GroupingUtils extends Object
Utilities for creating or interacting with grouping information.
  • Constructor Details

    • GroupingUtils

      public GroupingUtils()
  • Method Details

    • getValueToRangeMap

      public static <TYPE> Map<TYPE,long[]> getValueToRangeMap(@NotNull @NotNull TrackingRowSet rowSet, @Nullable @Nullable ColumnSource<TYPE> columnSource)
      Get a map from unique, boxed values in this column to a long[2] range of keys.
      Parameters:
      rowSet - The RowSet that defines the column along with the column source
      columnSource - The column source that defines the column along with the RowSet
      Returns:
      A new value to range map (i.e. grouping metadata)
    • forEachGroup

      public static <TYPE> void forEachGroup(@NotNull @NotNull Map<TYPE,RowSet> groupToRowSet, @NotNull @NotNull BiConsumer<TYPE,WritableRowSet> groupConsumer)
      Consume all groups in a group-to-RowSet map.
      Parameters:
      groupToRowSet - The group-to-RowSet map to consume
      groupConsumer - Consumer for responsive groups
    • groupingToFlatSources

      public static <TYPE> Pair<WritableColumnSource<TYPE>,ObjectArraySource<TrackingWritableRowSet>> groupingToFlatSources(@NotNull @NotNull ColumnSource<TYPE> originalKeyColumnSource, @NotNull @NotNull Map<TYPE,RowSet> groupToRowSet)
      Convert a group-to-RowSet map to a pair of flat in-memory column sources, one for the keys and one for the indexes.
      Parameters:
      originalKeyColumnSource - The key column source whose contents are reflected by the group-to-RowSet map (used for typing, only)
      groupToRowSet - The group-to-RowSet map to convert
      Returns:
      A pair of a flat key column source and a flat RowSet column source
    • forEachResponsiveGroup

      public static <TYPE> void forEachResponsiveGroup(@NotNull @NotNull Map<TYPE,RowSet> groupToRowSet, @NotNull @NotNull RowSet intersect, @NotNull @NotNull BiConsumer<TYPE,WritableRowSet> groupConsumer)
      Consume all responsive groups in a group-to-RowSet map.
      Parameters:
      groupToRowSet - The group-to-RowSet map to consume
      intersect - Limit indices to values contained within intersect, eliminating empty result groups
      groupConsumer - Consumer for responsive groups
    • groupingToFlatSources

      public static <TYPE> Pair<WritableColumnSource<TYPE>,ObjectArraySource<TrackingWritableRowSet>> groupingToFlatSources(@NotNull @NotNull ColumnSource<TYPE> originalKeyColumnSource, @NotNull @NotNull Map<TYPE,RowSet> groupToRowSet, @NotNull @NotNull RowSet intersect, @NotNull @NotNull org.apache.commons.lang3.mutable.MutableInt responsiveGroups)
      Convert a group-to-RowSet map to a pair of flat in-memory column sources, one for the keys and one for the indexes.
      Parameters:
      originalKeyColumnSource - The key column source whose contents are reflected by the group-to-RowSet map (used for typing, only)
      groupToRowSet - The group-to-RowSet map to convert
      intersect - Limit returned indices to values contained within intersect
      responsiveGroups - Set to the number of responsive groups on exit
      Returns:
      A pair of a flat key column source and a flat rowSet column source
    • groupingKeysToImmutableFlatSource

      public static <TYPE> WritableColumnSource<TYPE> groupingKeysToImmutableFlatSource(@NotNull @NotNull ColumnSource<TYPE> originalKeyColumnSource, @NotNull @NotNull Map<TYPE,RowSet> groupToRowSet)
      Convert a group-to-RowSet map to a flat, immutable, in-memory column of keys.
      Parameters:
      originalKeyColumnSource - The key column source whose contents are reflected by the group-to-RowSet map (used for typing, only)
      groupToRowSet - The group-to-RowSet map to convert
      Returns:
      A flat, immutable, in-memory column of keys