Class Aggregate

    • Constructor Detail

      • Aggregate

        protected Aggregate​(RelOptCluster cluster,
                            RelTraitSet traitSet,
                            List<RelHint> hints,
                            RelNode input,
                            ImmutableBitSet groupSet,
                            List<ImmutableBitSet> groupSets,
                            List<AggregateCall> aggCalls)
        Creates an Aggregate.

        All members of groupSets must be sub-sets of groupSet. For a simple GROUP BY, groupSets is a singleton list containing groupSet.

        If GROUP BY is not specified, or equivalently if GROUP BY () is specified, groupSet will be the empty set, and groupSets will have one element, that empty set.

        If CUBE, ROLLUP or GROUPING SETS are specified, groupSets will have additional elements, but they must each be a subset of groupSet, and they must be sorted by inclusion: (0, 1, 2), (1), (0, 2), (0), ().

        cluster - Cluster
        traitSet - Trait set
        hints - Hints of this relational expression
        input - Input relational expression
        groupSet - Bit set of grouping fields
        groupSets - List of all grouping sets; null for just groupSet
        aggCalls - Collection of calls to aggregate functions
      • Aggregate

        protected Aggregate​(RelInput input)
        Creates an Aggregate by parsing serialized output.
    • Method Detail

      • isSimple

        public static boolean isSimple​(Aggregate aggregate)
      • checkIndicator

        public static void checkIndicator​(boolean indicator)
        Used internally; will removed when indicator is removed, before 2.0.
      • isNotGrandTotal

        public static boolean isNotGrandTotal​(Aggregate aggregate)
      • copy

        public final RelNode copy​(RelTraitSet traitSet,
                                  List<RelNode> inputs)
        Description copied from interface: RelNode
        Creates a copy of this relational expression, perhaps changing traits and inputs.

        Sub-classes with other important attributes are encouraged to create variants of this method with more parameters.

        Specified by:
        copy in interface RelNode
        copy in class AbstractRelNode
        traitSet - Trait set
        inputs - Inputs
        Copy of this relational expression, substituting traits and inputs
      • getAggCallList

        public List<AggregateCall> getAggCallList()
        Returns a list of calls to aggregate functions.
        list of calls to aggregate functions
      • getNamedAggCalls

        public List<Pair<AggregateCall,​String>> getNamedAggCalls()
        Returns a list of calls to aggregate functions together with their output field names.
        list of calls to aggregate functions and their output field names
      • getGroupCount

        public int getGroupCount()
        Returns the number of grouping fields. These grouping fields are the leading fields in both the input and output records.

        NOTE: The getGroupSet() data structure allows for the grouping fields to not be on the leading edge. New code should, if possible, assume that grouping fields are in arbitrary positions in the input relational expression.

        number of grouping fields
      • getIndicatorCount

        public int getIndicatorCount()
        Returns the number of indicator fields.

        Always zero.

        number of indicator fields, always zero
      • getGroupSet

        public ImmutableBitSet getGroupSet()
        Returns a bit set of the grouping fields.
        bit set of ordinals of grouping fields
      • getGroupSets

        public<ImmutableBitSet> getGroupSets()
        Returns the list of grouping sets computed by this Aggregate.
        List of all grouping sets; null for just groupSet
      • deriveRowType

        public static RelDataType deriveRowType​(RelDataTypeFactory typeFactory,
                                                RelDataType inputRowType,
                                                boolean indicator,
                                                ImmutableBitSet groupSet,
                                                List<ImmutableBitSet> groupSets,
                                                List<AggregateCall> aggCalls)
        Computes the row type of an Aggregate before it exists.
        typeFactory - Type factory
        inputRowType - Input row type
        indicator - Deprecated, always false
        groupSet - Bit set of grouping fields
        groupSets - List of all grouping sets; null for just groupSet
        aggCalls - Collection of calls to aggregate functions
        Row type of the aggregate
      • isValid

        public boolean isValid​(Litmus litmus,
                               RelNode.Context context)
        Description copied from interface: RelNode
        Returns whether this relational expression is valid.

        If assertions are enabled, this method is typically called with litmus = THROW, as follows:

        assert rel.isValid(Litmus.THROW)

        This signals that the method can throw an AssertionError if it is not valid.

        Specified by:
        isValid in interface RelNode
        isValid in class AbstractRelNode
        litmus - What to do if invalid
        context - Context for validity checking
        Whether relational expression is valid
      • containsDistinctCall

        public boolean containsDistinctCall()
        Returns whether any of the aggregates are DISTINCT.
        Whether any of the aggregates are DISTINCT
      • getHints

        public<RelHint> getHints()
        Description copied from interface: Hintable
        Returns the hints of this relational expressions as an immutable list.
        Specified by:
        getHints in interface Hintable
      • getGroupType

        public Aggregate.Group getGroupType()
        Returns the type of roll-up.
        Type of roll-up