All Known Subinterfaces:
Groups.GroupingSetsBuilder

public interface Groups
List of grouping builder to be used in PipelineStage.aggregateByGroups(Function, Function)
  • 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,

      
       qapi.groups().cube([a, b, c])
       // is equivalent to
       qapi.groups().groupingSets(
         [a, b, c],
         [a, b],
         [a, c],
         [a],
         [b, c],
         [b],
         [c],
         []
       )
       
      If you provide several lists, then the cube will be computed over the lists

      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,

      
       qapi.groups().rollup([a, b, c])
       // is equivalent to
       qapi.groups().groupingSets(
         [a, b, c],
         [a, b],
         [a],
         []
       )
       
      If you provide several lists, then the rollup will be computed over the lists

      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

      Groups.GroupingSetsBuilder groupingSets(List<Expression>... groups)
      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() or Groups.GroupingSetsBuilder.notDistinct()
      Since:
      16.3.12 - Black Cat, 17.0.3 - Paloma