Package com.illumon.iris.db.v2.dataindex
Class StaticGroupingProvider<T>
java.lang.Object
com.illumon.iris.db.v2.dataindex.MemoizingGroupingProvider
com.illumon.iris.db.v2.dataindex.StaticGroupingProvider<T>
- Type Parameters:
T
- the key type.
- All Implemented Interfaces:
GroupingProvider
public class StaticGroupingProvider<T> extends MemoizingGroupingProvider implements GroupingProvider
A
GroupingProvider
implementation that constructs groupings from a statically precomputed grouping table.
Users should construct instances using buildFrom(ColumnSource, Index)
-
Method Summary
Modifier and Type Method Description static <T> StaticGroupingProvider<T>
buildFrom(Table inputGrouping, String valueColumnName, String indexColumnName)
Wrap the specified grouping in a newStaticGroupingProvider
.static <T> StaticGroupingProvider<T>
buildFrom(ColumnSource<T> source, Index indexOfInterest)
Construct a newStaticGroupingProvider
from the specified column source and index of interest.static <T> StaticGroupingProvider<T>
buildFrom(ColumnSource<T> source, Index indexOfInterest, boolean useExistingGrouping)
Construct a newStaticGroupingProvider
from the specified column source and index of interest.static <T> StaticGroupingProvider<T>
buildFrom(Map<T,ReadOnlyIndex> baseGrouping)
Construct a newStaticGroupingProvider
from the specified grouping map.static <T> StaticGroupingProvider<T>
buildFrom(Map<T,ReadOnlyIndex> baseGrouping, com.illumon.dataobjects.ColumnDefinition<T> groupingColDef)
Construct a newStaticGroupingProvider
from the specified grouping map.static <T> StaticGroupingProvider<T>
buildFrom(Map<T,ReadOnlyIndex> baseGrouping, Class<T> groupingValueType, Class<?> groupingValueComponentType)
Construct a newStaticGroupingProvider
from the specified grouping map.com.illumon.iris.db.v2.dataindex.StaticGroupingProvider.StaticGroupingBuilder
getGroupingBuilder()
Get aGroupingBuilder
suitable for creating groups with specific properties.boolean
hasGrouping()
Check if this provider is able to create a grouping or not.Methods inherited from class com.illumon.iris.db.v2.dataindex.MemoizingGroupingProvider
clearMemoizedGroupings, memoizeGrouping
-
Method Details
-
getGroupingBuilder
@NotNull public com.illumon.iris.db.v2.dataindex.StaticGroupingProvider.StaticGroupingBuilder getGroupingBuilder()Description copied from interface:GroupingProvider
Get aGroupingBuilder
suitable for creating groups with specific properties.- Specified by:
getGroupingBuilder
in interfaceGroupingProvider
- Returns:
- a
GroupingBuilder
-
hasGrouping
public boolean hasGrouping()Description copied from interface:GroupingProvider
Check if this provider is able to create a grouping or not.- Specified by:
hasGrouping
in interfaceGroupingProvider
- Returns:
- true if this provider can create a grouping.
-
buildFrom
@NotNull public static <T> StaticGroupingProvider<T> buildFrom(@NotNull Table inputGrouping, @NotNull String valueColumnName, @NotNull String indexColumnName)Wrap the specified grouping in a newStaticGroupingProvider
.- Type Parameters:
T
- The type of the column- Parameters:
inputGrouping
- The input grouping table to wrapvalueColumnName
- The name of the value column in the provided groupingindexColumnName
- The name of the index column in the provided grouping- Returns:
- a new
StaticGroupingProvider
.
-
buildFrom
@NotNull public static <T> StaticGroupingProvider<T> buildFrom(@NotNull ColumnSource<T> source, @NotNull Index indexOfInterest)Construct a newStaticGroupingProvider
from the specified column source and index of interest. Existing groupings will be used if it makes sense, otherwise new groupings will be computed directly.- Type Parameters:
T
- The type of the column- Parameters:
source
- The column source to groupindexOfInterest
- the index to use as the whole table index- Returns:
- a new
StaticGroupingProvider
.
-
buildFrom
@NotNull public static <T> StaticGroupingProvider<T> buildFrom(@NotNull ColumnSource<T> source, @NotNull Index indexOfInterest, boolean useExistingGrouping)Construct a newStaticGroupingProvider
from the specified column source and index of interest. Existing groupings will be used if it makes sense, otherwise new groupings will be computed directly.- Type Parameters:
T
- The type of the column- Parameters:
source
- The column source to groupindexOfInterest
- the index to use as the whole table indexuseExistingGrouping
- if existing groups should be used to compute the static grouping.- Returns:
- a new
StaticGroupingProvider
.
-
buildFrom
@NotNull public static <T> StaticGroupingProvider<T> buildFrom(@NotNull Map<T,ReadOnlyIndex> baseGrouping)Construct a newStaticGroupingProvider
from the specified grouping map. This will attempt to infer the grouping column type from the values within the grouping.- Type Parameters:
T
- the key type.- Parameters:
baseGrouping
- the base grouping map.- Returns:
- a new
StaticGroupingProvider
-
buildFrom
@NotNull public static <T> StaticGroupingProvider<T> buildFrom(@NotNull Map<T,ReadOnlyIndex> baseGrouping, @NotNull com.illumon.dataobjects.ColumnDefinition<T> groupingColDef)Construct a newStaticGroupingProvider
from the specified grouping map.- Type Parameters:
T
- the key type.- Parameters:
baseGrouping
- the base grouping map.groupingColDef
- TheColumnDefinition
of the grouping column- Returns:
- a new
StaticGroupingProvider
-
buildFrom
@NotNull public static <T> StaticGroupingProvider<T> buildFrom(@NotNull Map<T,ReadOnlyIndex> baseGrouping, @NotNull Class<T> groupingValueType, @Nullable Class<?> groupingValueComponentType)Construct a newStaticGroupingProvider
from the specified grouping map.- Type Parameters:
T
- the key type.- Parameters:
baseGrouping
- the base grouping map.groupingValueType
- The type of the grouping columngroupingValueComponentType
- the component type of the grouping column, if it was an array.- Returns:
- a new
StaticGroupingProvider
-