Class AggregateSymbol

  • All Implemented Interfaces:
    Cloneable, LanguageObject, DerivedExpression, Expression, NamedExpression

    public class AggregateSymbol
    extends Function
    implements DerivedExpression, NamedExpression

    An aggregate symbol represents an aggregate function. The * expression is encoded by setting the expression to null. This may ONLY be used with the COUNT function.

    The type of an aggregate symbol depends on the function and the type of the underlying expression. The type of a COUNT function is ALWAYS integer. MIN and MAX functions take the type of their contained expression.

    • Field Detail

      • LONG_RANKS

        public static final boolean LONG_RANKS
    • Constructor Detail

      • AggregateSymbol

        protected AggregateSymbol​(String name,
                                  AggregateSymbol.Type aggregateFunction,
                                  boolean isDistinct,
                                  Expression[] args)
        Constructor used for cloning
        Parameters:
        name -
        aggregateFunction -
        Since:
        4.3
      • AggregateSymbol

        public AggregateSymbol​(String aggregateFunction,
                               boolean isDistinct,
                               Expression expression)
        Construct an aggregate symbol with all given data.
        Parameters:
        aggregateFunction - Aggregate function type (SQLConstants.NonReserved.COUNT, etc)
        isDistinct - True if DISTINCT flag is set
        expression - Contained expression
      • AggregateSymbol

        public AggregateSymbol​(String aggregateFunction,
                               boolean isDistinct,
                               Expression[] args,
                               OrderBy orderBy)
    • Method Detail

      • getAggregateFunction

        public AggregateSymbol.Type getAggregateFunction()
        Get the aggregate function type - this will map to one of the reserved words for the aggregate functions.
        Returns:
        Aggregate function type
      • isRowValueFunction

        public boolean isRowValueFunction()
      • isDistinct

        public boolean isDistinct()
        Get the distinct flag. If true, aggregate symbol will remove duplicates during computation.
        Returns:
        True if duplicates should be removed during computation
      • setDistinct

        public void setDistinct​(boolean distinct)
      • getType

        public Class<?> getType()
        Get the type of the symbol, which depends on the aggregate function and the type of the contained expression
        Specified by:
        getType in interface Expression
        Overrides:
        getType in class Function
        Returns:
        Type of the symbol
      • isRanking

        public boolean isRanking()
      • isCount

        public boolean isCount()
      • isAnalytical

        public boolean isAnalytical()
      • isBoolean

        public boolean isBoolean()
      • isEnhancedNumeric

        public boolean isEnhancedNumeric()
      • getOrderBy

        public OrderBy getOrderBy()
      • setOrderBy

        public void setOrderBy​(OrderBy orderBy)
      • hashCode

        public int hashCode()
        Description copied from class: Function
        Compute hash code for the object - based on name and hashcode of first arg (if there is one)
        Overrides:
        hashCode in class Function
        Returns:
        Hash code
        See Also:
        ExpressionSymbol.hashCode()
      • isCardinalityDependent

        public boolean isCardinalityDependent()
      • setCondition

        public void setCondition​(Expression condition)
      • areAggregatesCardinalityDependent

        public static boolean areAggregatesCardinalityDependent​(Collection<AggregateSymbol> aggs)
      • respectsNulls

        public boolean respectsNulls()
      • canStage

        public boolean canStage()
      • isWindowed

        public boolean isWindowed()
      • setWindowed

        public void setWindowed​(boolean isWindowed)