Package com.illumon.iris.db.v2.dataindex
Class AbstractGroupingBuilder
java.lang.Object
com.illumon.iris.db.v2.dataindex.AbstractGroupingBuilder
- All Implemented Interfaces:
GroupingBuilder
The base implementation for
GroupingBuilder provides fields and methods that are common to all implementations.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Object[]protected ReadOnlyIndexprotected booleanprotected ReadOnlyIndexprotected booleanprotected booleanprotected boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddRegionMutator(Function<Table, Table> mutator) Add a method that will process tables per region.protected TableapplyIntersectAndInvert(Table groupingTable) Apply strict intersection and invert operations as required by the current builder state.<T> Map<T,ReadOnlyIndex> Build a Map of the Grouping values based on the current configuration of this builder.clampToIndex(ReadOnlyIndex indexOfInterest, boolean strictIntersect) Clamp the returned table of indices to the specified range.protected TablecondenseGrouping(Table baseTable) protected <DATA_TYPE>
Map<DATA_TYPE,ReadOnlyIndex> convertToMap(Table groupingTable) Convert the final table into a Map of key.protected booleanCheck if the current configuration is memoizable.protected GroupingMemoKeyCreate aGroupingMemoKeyfor the current builder state.Only include keys in the resultant grouping that match the specified set of grouping keys, optionally ignoring case or inverting the match.protected TablemaybeApplyMatch(Table baseTable) Ifmatchingwas requested, apply it to the parameter table.protected TablemaybeSortByFirsKey(Table grouping) If requested, sort the input table by the first key of its index column.positionally(ReadOnlyIndex inverter) Construct groupings as positions, as if the source index were flat.Sort the final grouping table by the first key within each group.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.illumon.iris.db.v2.dataindex.GroupingBuilder
buildTable, clampToIndex, estimateGroupingSize, getIndexColumnName, getValueColumnName
-
Field Details
-
regionMutators
-
indexOfInterest
-
strictIntersect
protected boolean strictIntersect -
sortByFirstKey
protected boolean sortByFirstKey -
inverter
-
matchCase
protected boolean matchCase -
invert
protected boolean invert -
groupKeys
-
-
Constructor Details
-
AbstractGroupingBuilder
public AbstractGroupingBuilder()
-
-
Method Details
-
addRegionMutator
Description copied from interface:GroupingBuilderAdd a method that will process tables per region. If the mutator returns a null or empty table, it will not be passed to the following mutators.- Specified by:
addRegionMutatorin interfaceGroupingBuilder- Parameters:
mutator- a function to process the input tables.- Returns:
- this
GroupingBuilder
-
sortByFirstKey
Description copied from interface:GroupingBuilderSort the final grouping table by the first key within each group. This can be useful to maintain visitation order.- Specified by:
sortByFirstKeyin interfaceGroupingBuilder- Returns:
- this
GroupingBuilder
-
matching
Description copied from interface:GroupingBuilderOnly include keys in the resultant grouping that match the specified set of grouping keys, optionally ignoring case or inverting the match. The grouping keys must not be empty.- Specified by:
matchingin interfaceGroupingBuilder- Parameters:
matchCase- if matches should consider caseinvert- if the match should be invertedgroupKeys- the set of keys to match- Returns:
- this
GroupingBuilder
-
clampToIndex
@NotNull public GroupingBuilder clampToIndex(@NotNull ReadOnlyIndex indexOfInterest, boolean strictIntersect) Description copied from interface:GroupingBuilderClamp the returned table of indices to the specified range. In strict mode, guarantees that the indices returned for each group include ony indices in the specified index.- Specified by:
clampToIndexin interfaceGroupingBuilder- Parameters:
indexOfInterest- the index of intereststrictIntersect- when true, the final table will contain only indices that are part of 'index'- Returns:
- this
GroupingBuilder
-
positionally
Description copied from interface:GroupingBuilderConstruct groupings as positions, as if the source index were flat.- Specified by:
positionallyin interfaceGroupingBuilder- Returns:
- this
GroupingBuilder
-
buildGroupingMap
Description copied from interface:GroupingBuilderBuild a Map of the Grouping values based on the current configuration of this builder. Note that the returned map will respect the table order of the final table.- Specified by:
buildGroupingMapin interfaceGroupingBuilder- Returns:
- a properly ordered Map of key to read only index.
-
convertToMap
@NotNull protected <DATA_TYPE> Map<DATA_TYPE,ReadOnlyIndex> convertToMap(@Nullable Table groupingTable) Convert the final table into a Map of key.- Type Parameters:
DATA_TYPE- the type of the key- Parameters:
groupingTable- the table to convert- Returns:
- the grouping table converted into a
Map
-
applyIntersectAndInvert
Apply strict intersection and invert operations as required by the current builder state.- Parameters:
groupingTable- the table to apply the operations to.- Returns:
- the table with intersections and inversions applied.
-
maybeSortByFirsKey
If requested, sort the input table by the first key of its index column.- Parameters:
grouping- the input grouping.- Returns:
- the table sorted by first key, if requested.
-
maybeApplyMatch
Ifmatchingwas requested, apply it to the parameter table.- Parameters:
baseTable- the table to apply to- Returns:
- the table with matching applied if required.
-
condenseGrouping
-
makeMemoKey
Create aGroupingMemoKeyfor the current builder state.- Returns:
- a memo key
-
isMemoizable
protected boolean isMemoizable()Check if the current configuration is memoizable.- Returns:
- true if it is memoizable
-