Class HashedGroupAggregateNode

  • All Implemented Interfaces:
    java.lang.Cloneable

    public class HashedGroupAggregateNode
    extends GroupAggregateNode
    Implements grouping and aggregation by using hashing as a method to identify groups.
    • Field Detail

      • logger

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

        private java.util.LinkedHashMap<TupleLiteral,​java.util.Map<java.lang.String,​FunctionCall>> computedAggregates
      • groupIterator

        private java.util.Iterator<TupleLiteral> groupIterator
      • done

        private boolean done
    • Constructor Detail

      • HashedGroupAggregateNode

        public HashedGroupAggregateNode​(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 hashed grouping/aggregate operation does not order its results in any way.
        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 hashed 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 hashed 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 hashed 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.
        Throws:
        java.lang.IllegalStateException - if a plan node is not properly initialized
      • computeAggregates

        private void computeAggregates()
        This helper function iterates through all tuples generated by the subplan, using an internal hash table to compute the grouping and aggregate results that this plan-node will output.
      • 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 hashed grouping/aggregate plan node doesn't support marking.
        Overrides:
        markCurrentPosition in class PlanNode
        Throws:
        java.lang.UnsupportedOperationException - always.
      • resetToLastMark

        public void resetToLastMark()
        The hashed 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