Class GroupBy

  • All Implemented Interfaces:
    Cloneable, LanguageObject

    public class GroupBy
    extends Object
    implements LanguageObject
    This class represents the GROUP BY clause of a query, which defines the expressions that should be used for grouping the results of the query. The groups produced in the query are grouped on all symbols listed contained in the GROUP BY clause. The GROUP BY clause may not contain aliased elements, expressions, or constants.
    • Constructor Detail

      • GroupBy

        public GroupBy()
        Constructs a default instance of this class.
      • GroupBy

        public GroupBy​(List<? extends Expression> symbols)
        Constructs an instance of this class from an ordered set of symbols.
        Parameters:
        symbols - The ordered list of ElementSymbols
    • Method Detail

      • getCount

        public int getCount()
        Returns the number of symbols in the GROUP BY
        Returns:
        Count of the number of symbols in GROUP BY
      • getSymbols

        public List<Expression> getSymbols()
        Returns an ordered list of the symbols in the GROUP BY
        Returns:
        List of ElementSymbols
      • addSymbol

        public void addSymbol​(Expression symbol)
        Adds a new symbol to the list of symbols.
        Parameters:
        symbol - Symbol to add to GROUP BY
      • acceptVisitor

        public void acceptVisitor​(LanguageVisitor visitor)
        Description copied from interface: LanguageObject
        Method for accepting a visitor. It is the responsibility of the language object to call back on the visitor.
        Specified by:
        acceptVisitor in interface LanguageObject
        Parameters:
        visitor - Visitor being used
      • equals

        public boolean equals​(Object obj)
        Compare two GroupBys for equality. Order is important in the comparison.
        Overrides:
        equals in class Object
        Parameters:
        obj - Other object
        Returns:
        True if equal
      • hashCode

        public int hashCode()
        Get hashcode for GroupBy. WARNING: The hash code relies on the variables in the group by, so changing the variables will change the hash code, causing a group by to be lost in a hash structure. Do not hash a GroupBy if you plan to change it.
        Overrides:
        hashCode in class Object
        Returns:
        Hash code for object
      • toString

        public String toString()
        Returns a string representation of an instance of this class.
        Overrides:
        toString in class Object
        Returns:
        String representation of object
      • isRollup

        public boolean isRollup()
      • setRollup

        public void setRollup​(boolean rollup)