Package io.deephaven.engine.table.impl
Class GroupingUtils
java.lang.Object
io.deephaven.engine.table.impl.GroupingUtils
Utilities for creating or interacting with grouping information.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <TYPE> void
forEachGroup
(@NotNull Map<TYPE, RowSet> groupToRowSet, @NotNull BiConsumer<TYPE, WritableRowSet> groupConsumer) Consume all groups in a group-to-RowSet map.static <TYPE> void
forEachResponsiveGroup
(@NotNull Map<TYPE, RowSet> groupToRowSet, @NotNull RowSet intersect, @NotNull BiConsumer<TYPE, WritableRowSet> groupConsumer) Consume all responsive groups in a group-to-RowSet map.static <TYPE> Map<TYPE,
long[]> getValueToRangeMap
(@NotNull TrackingRowSet rowSet, @Nullable ColumnSource<TYPE> columnSource) Get a map from unique, boxed values in this column to a long[2] range of keys.static <TYPE> WritableColumnSource<TYPE>
groupingKeysToImmutableFlatSource
(@NotNull ColumnSource<TYPE> originalKeyColumnSource, @NotNull Map<TYPE, RowSet> groupToRowSet) Convert a group-to-RowSet map to a flat, immutable, in-memory column of keys.static <TYPE> Pair<WritableColumnSource<TYPE>,
ObjectArraySource<TrackingWritableRowSet>> groupingToFlatSources
(@NotNull ColumnSource<TYPE> originalKeyColumnSource, @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.static <TYPE> Pair<WritableColumnSource<TYPE>,
ObjectArraySource<TrackingWritableRowSet>> groupingToFlatSources
(@NotNull ColumnSource<TYPE> originalKeyColumnSource, @NotNull Map<TYPE, RowSet> groupToRowSet, @NotNull RowSet intersect, @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.
-
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 sourcecolumnSource
- 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 consumegroupConsumer
- 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 consumeintersect
- Limit indices to values contained within intersect, eliminating empty result groupsgroupConsumer
- 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 convertintersect
- Limit returned indices to values contained within intersectresponsiveGroups
- 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
-