Class SortedGroupAggregateNode

  • All Implemented Interfaces:
    java.lang.Cloneable

    public class SortedGroupAggregateNode
    extends GroupAggregateNode
    Implements grouping and aggregation by using sorting as a method to find groups.
    • Field Detail

      • logger

        private static org.apache.logging.log4j.Logger logger
        A logging object for reporting anything interesting that happens.
      • done

        private boolean done
      • currentGroupValues

        private TupleLiteral currentGroupValues
        A tuple of the current group-by values being considered. When each tuple is retrieved from the subplan, a set of group-by values is computed, and if it matches this set of group-by values then we are still in the same group; otherwise, we have moved to the next group.
    • Constructor Detail

      • SortedGroupAggregateNode

        public SortedGroupAggregateNode​(PlanNode subplan,
                                        java.util.List<Expression> groupByExprs,
                                        java.util.Map<java.lang.String,​FunctionCall> aggregates)
    • Method Detail

      • equals

        public boolean equals​(java.lang.Object obj)
        Description copied from class: PlanNode
        Checks if the argument is a plan node tree with the same structure, but not necesarily the same references.
        Specified by:
        equals in class PlanNode
        Parameters:
        obj - the object to which we are comparing
      • hashCode

        public int hashCode()
        Description copied from class: PlanNode
        Computes the hash-code of a plan-node, including any sub-plans of this plan. This method is used to see if two plan nodes (or subtrees) might be equal.
        Specified by:
        hashCode in class PlanNode
        Returns:
        the hash code for the plan node and any subnodes it may contain.
      • toString

        public java.lang.String toString()
        Description copied from class: PlanNode
        Reports this node and its vital parameters as a string.
        Specified by:
        toString in class PlanNode
        Returns:
        the node in string format.
      • resultsOrderedBy

        public java.util.List<OrderByExpression> resultsOrderedBy()
        The sorted grouping/aggregate operation orders its results according to the columns in the GROUP BY clause.
        Specified by:
        resultsOrderedBy in class PlanNode
        Returns:
        If the plan node produces ordered results, this will be a list of objects specifying the ordering. If the node doesn't produce ordered results then the return-value will either be an empty list or it will be null.
      • supportsMarking

        public boolean supportsMarking()
        The sorted grouping/aggregate operation does not support marking, since it must fully consume its input before it can produce any results.
        Overrides:
        supportsMarking in class PlanNode
        Returns:
        true if the node supports position marking, false otherwise.
      • requiresLeftMarking

        public boolean requiresLeftMarking()
        The sorted grouping/aggregate operation does not require marking.
        Overrides:
        requiresLeftMarking in class PlanNode
        Returns:
        true if the node requires that its left child supports marking, false otherwise.
      • requiresRightMarking

        public boolean requiresRightMarking()
        The sorted grouping/aggregate operation does not require marking.
        Overrides:
        requiresRightMarking in class PlanNode
        Returns:
        true if the node requires that its right child supports marking, false otherwise.
      • getNextTuple

        public Tuple getNextTuple()
        Gets the next tuple that fulfills the conditions for this plan node. If the node has a child, it should call getNextTuple() on the child. If the node is a leaf, the tuple comes from some external source such as a table file, the network, etc.
        Specified by:
        getNextTuple in class PlanNode
        Returns:
        the next tuple to be generated by this plan, or null if the plan has finished generating plan nodes.
      • prepare

        public void prepare()
        Description copied from class: PlanNode
        This method is responsible for computing critical details about the plan node, such as the schema of the results that are produced, the estimated cost of evaluating the plan node (and its children), and statistics describing the results produced by the plan node.
        Specified by:
        prepare in class PlanNode
      • initialize

        public void initialize()
        Does any initialization the node might need. This could include resetting state variables or starting the node over from the beginning.
        Overrides:
        initialize in class PlanNode
      • markCurrentPosition

        public void markCurrentPosition()
                                 throws java.lang.UnsupportedOperationException
        The sorted grouping/aggregate plan node doesn't support marking.
        Overrides:
        markCurrentPosition in class PlanNode
        Throws:
        java.lang.UnsupportedOperationException - always.
      • resetToLastMark

        public void resetToLastMark()
        The sorted grouping/aggregate plan node doesn't support marking.
        Overrides:
        resetToLastMark in class PlanNode
        Throws:
        java.lang.UnsupportedOperationException - always.
      • cleanUp

        public void cleanUp()
        Perform any necessary clean up tasks. This should probably be called when we are done with this plan node.
        Specified by:
        cleanUp in class PlanNode