Package edu.caltech.nanodb.plannodes
Class RenameNode
- java.lang.Object
-
- edu.caltech.nanodb.plannodes.PlanNode
-
- edu.caltech.nanodb.plannodes.RenameNode
-
- All Implemented Interfaces:
java.lang.Cloneable
public class RenameNode extends PlanNode
This plan-node implements the Rename relational algebra operation, for either renaming a table in a query, or assigning a table-name to a derived relation. Note that at present, it is not possible to rename individual columns. That should be done with theProjectNode
instead.
-
-
Field Summary
Fields Modifier and Type Field Description private static org.apache.logging.log4j.Logger
logger
A logging object for reporting anything interesting that happens.private java.lang.String
resultTableName
The result table-name to use in the output schema of this plan-node.-
Fields inherited from class edu.caltech.nanodb.plannodes.PlanNode
cost, environment, leftChild, rightChild, schema, stats
-
-
Constructor Summary
Constructors Constructor Description RenameNode(PlanNode subplan, java.lang.String resultTableName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cleanUp()
Perform any necessary clean up tasks.boolean
equals(java.lang.Object obj)
Checks if the argument is a plan node tree with the same structure, but not necesarily the same references.Tuple
getNextTuple()
Gets the next tuple that fulfills the conditions for this plan node.int
hashCode()
Computes the hash-code of a plan-node, including any sub-plans of this plan.void
initialize()
Does any initialization the node might need, including setting up the node's execution environment.void
markCurrentPosition()
Marks the current tuple in the tuple-stream produced by this node.void
prepare()
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.boolean
requiresLeftMarking()
This method reports whether this plan node requires the left child to support marking for proper evaluation.boolean
requiresRightMarking()
This method reports whether this plan node requires the right child to support marking for proper evaluation.void
resetToLastMark()
Resets the node's tuple-stream to the most recently marked position.java.util.List<OrderByExpression>
resultsOrderedBy()
If the results are ordered in some way, this method returns a collection of expressions specifying what columns or expressions the results are ordered by.boolean
supportsMarking()
This method reports whether this plan node supports marking a certain point in the tuple-stream so that processing can return to that point as needed.java.lang.String
toString()
Reports this node and its vital parameters as a string.-
Methods inherited from class edu.caltech.nanodb.plannodes.PlanNode
addParentEnvironmentToPlanTree, clone, duplicate, getCost, getEnvironment, getSchema, getStats, printNodeTree, printNodeTree, printNodeTree, printNodeTreeToString, printNodeTreeToString, setEnvironment
-
-
-
-
Constructor Detail
-
RenameNode
public RenameNode(PlanNode subplan, java.lang.String resultTableName)
-
-
Method Detail
-
resultsOrderedBy
public java.util.List<OrderByExpression> resultsOrderedBy()
Description copied from class:PlanNode
If the results are ordered in some way, this method returns a collection of expressions specifying what columns or expressions the results are ordered by. If the results are not ordered then this method may return either an empty list or a null value.When this method returns a list of ordering expressions, the order of the expressions themselves also matters. The entire set of results will be ordered by the first expression; rows with the same value for the first expression will be ordered by the second expression; etc.
- Specified by:
resultsOrderedBy
in classPlanNode
- 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()
Description copied from class:PlanNode
This method reports whether this plan node supports marking a certain point in the tuple-stream so that processing can return to that point as needed.- Overrides:
supportsMarking
in classPlanNode
- Returns:
- true if the node supports position marking, false otherwise.
-
requiresLeftMarking
public boolean requiresLeftMarking()
Description copied from class:PlanNode
This method reports whether this plan node requires the left child to support marking for proper evaluation.- Overrides:
requiresLeftMarking
in classPlanNode
- Returns:
- true if the node requires that its left child supports marking, false otherwise.
-
requiresRightMarking
public boolean requiresRightMarking()
Description copied from class:PlanNode
This method reports whether this plan node requires the right child to support marking for proper evaluation.- Overrides:
requiresRightMarking
in classPlanNode
- Returns:
- true if the node requires that its right child supports marking, false otherwise.
-
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.
-
initialize
public void initialize()
Description copied from class:PlanNode
Does any initialization the node might need, including setting up the node's execution environment. Subclasses ofPlanNode
can extend this method to perform other kinds of initialization, but they must be sure to call their parent class' implementation as well.- Overrides:
initialize
in classPlanNode
-
getNextTuple
public Tuple getNextTuple()
Description copied from class:PlanNode
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 classPlanNode
- Returns:
- the next tuple to be generated by this plan, or null if the plan has finished generating plan nodes.
-
markCurrentPosition
public void markCurrentPosition() throws java.lang.UnsupportedOperationException
Description copied from class:PlanNode
Marks the current tuple in the tuple-stream produced by this node. ThePlanNode.resetToLastMark()
method can be used to return to this tuple. Note that only one marker can be set in the tuple-stream at a time.- Overrides:
markCurrentPosition
in classPlanNode
- Throws:
java.lang.UnsupportedOperationException
- if the node does not support marking.
-
resetToLastMark
public void resetToLastMark()
Description copied from class:PlanNode
Resets the node's tuple-stream to the most recently marked position. Note that only one marker can be set in the tuple-stream at a time.- Overrides:
resetToLastMark
in classPlanNode
-
cleanUp
public void cleanUp()
Description copied from class:PlanNode
Perform any necessary clean up tasks. This should probably be called when we are done with this plan node.
-
toString
public java.lang.String toString()
Description copied from class:PlanNode
Reports this node and its vital parameters as a string.
-
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.
-
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.
-
-