Class SelectNode

  • All Implemented Interfaces:
    Direct Known Subclasses:
    FileScanNode, SimpleFilterNode

    public abstract class SelectNode
    extends PlanNode
    PlanNode representing the WHERE clause in a SELECT operation. This is the relational algebra Select operator.
    • Field Detail

      • predicate

        public Expression predicate
        Predicate used for selection.
      • currentTuple

        protected Tuple currentTuple
        The current tuple that the node is selecting.
      • done

        private boolean done
        True if we have finished scanning or pulling tuples from children.
    • Constructor Detail

      • SelectNode

        protected SelectNode​(Expression predicate)
        Constructs a SelectNode that scans a file for tuples.
        predicate - the selection criterion
    • Method Detail

      • clone

        protected PlanNode clone()
                          throws java.lang.CloneNotSupportedException
        Creates a copy of this select node and its subtree. This method is used by PlanNode.duplicate() to copy a plan tree.
        clone in class PlanNode
      • initialize

        public void initialize()
        Do initialization for the select operation. Resets state variables.
        initialize in class PlanNode
      • getNextTuple

        public Tuple getNextTuple()
        Gets the next tuple selected by the predicate.
        Specified by:
        getNextTuple in class PlanNode
        the tuple to be passed up to the next node.
        java.lang.IllegalStateException - if this is a scanning node with no algorithm or a filtering node with no child, or if the leftChild threw an IllegalStateException.
      • advanceCurrentTuple

        protected abstract void advanceCurrentTuple()
        Helper function that advances the current tuple reference in the node.
      • isTupleSelected

        protected boolean isTupleSelected​(Tuple tuple)