Interface Groups
- All Known Subinterfaces:
Groups.GroupingSetsBuilder
public interface Groups
List of grouping builder to be used in
PipelineStage.aggregateByGroups(Function, Function)-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceRepresents a list of groupings to be used inPipelineStage.aggregateByGroups(Function, Function)static interface -
Method Summary
Modifier and TypeMethodDescriptioncube(List<Expression>... groups) Builds the cube list of grouping from a given list of expressions or sub lists of expressions.groupingSets(List<Expression>... groups) Builds a representation of a list of grouping to aggregate on.rollup(List<Expression>... groups) Builds the rollup grouping list from a given list of expressions or sub lists of expressions.
-
Method Details
-
cube
Builds the cube list of grouping from a given list of expressions or sub lists of expressions.It results to the given list plus all of its possible subsets (i.e. the power set).
For example,
If you provide several lists, then the cube will be computed over the listsqapi.groups().cube([a, b, c]) // is equivalent to qapi.groups().groupingSets( [a, b, c], [a, b], [a, c], [a], [b, c], [b], [c], [] )For example,
qapi.groups().cube([a, b], [c, d]]) // is equivalent to qapi.groups().groupingSets( [a, b, c , d], [a, b], [c, d], [] )- Parameters:
groups- list of column groups to cube over; must not be null or empty, and no group may be empty- Returns:
- the current groups builder
- Since:
- 16.3.12 - Black Cat, 17.0.3 - Paloma
- See Also:
-
rollup
Builds the rollup grouping list from a given list of expressions or sub lists of expressions.It results to the given list of expressions and all prefixes of the list including the empty list. For example,
If you provide several lists, then the rollup will be computed over the listsqapi.groups().rollup([a, b, c]) // is equivalent to qapi.groups().groupingSets( [a, b, c], [a, b], [a], [] )For example,
qapi.groups().rollup([a],[b, c], d]]) // is equivalent to qapi.groups().groupingSets( [a, b, c , d], [a, b, c], [a], [] )- Parameters:
groups- list of column groups to roll up; must not be null or empty, and no group may be empty- Returns:
- the current groups builder
- Since:
- 16.3.12 - Black Cat, 17.0.3 - Paloma
- See Also:
-
groupingSets
Builds a representation of a list of grouping to aggregate on.Each sublist of groupingSets may specify zero or more expressions and is interpreted the same way as though it were directly in a
PipelineStage.aggregateBy(Function, Function)stage.An empty grouping set means that all rows are aggregated down to a single group.
- Parameters:
groups- explicit list of grouping sets; must not be null or empty- Returns:
- a builder to choose
Groups.GroupingSetsBuilder.distinct()orGroups.GroupingSetsBuilder.notDistinct() - Since:
- 16.3.12 - Black Cat, 17.0.3 - Paloma
-