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 ReadOnlyIndex
protected boolean
protected ReadOnlyIndex
protected boolean
protected boolean
protected boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddRegionMutator
(Function<Table, Table> mutator) Add a method that will process tables per region.protected Table
applyIntersectAndInvert
(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 Table
condenseGrouping
(Table baseTable) protected <DATA_TYPE>
Map<DATA_TYPE,ReadOnlyIndex> convertToMap
(Table groupingTable) Convert the final table into a Map of key.protected boolean
Check if the current configuration is memoizable.protected GroupingMemoKey
Create aGroupingMemoKey
for 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 Table
maybeApplyMatch
(Table baseTable) Ifmatching
was requested, apply it to the parameter table.protected Table
maybeSortByFirsKey
(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, wait
Methods 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:GroupingBuilder
Add 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:
addRegionMutator
in interfaceGroupingBuilder
- Parameters:
mutator
- a function to process the input tables.- Returns:
- this
GroupingBuilder
-
sortByFirstKey
Description copied from interface:GroupingBuilder
Sort the final grouping table by the first key within each group. This can be useful to maintain visitation order.- Specified by:
sortByFirstKey
in interfaceGroupingBuilder
- Returns:
- this
GroupingBuilder
-
matching
Description copied from interface:GroupingBuilder
Only 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:
matching
in 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:GroupingBuilder
Clamp 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:
clampToIndex
in 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:GroupingBuilder
Construct groupings as positions, as if the source index were flat.- Specified by:
positionally
in interfaceGroupingBuilder
- Returns:
- this
GroupingBuilder
-
buildGroupingMap
Description copied from interface:GroupingBuilder
Build 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:
buildGroupingMap
in 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
Ifmatching
was 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 aGroupingMemoKey
for 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
-