Package edu.caltech.nanodb.functions
Class TableFunction
- java.lang.Object
-
- edu.caltech.nanodb.functions.Function
-
- edu.caltech.nanodb.functions.TableFunction
-
- All Implemented Interfaces:
java.lang.Cloneable
public abstract class TableFunction extends Function
This is the base-class for all table-returning functions.
-
-
Constructor Summary
Constructors Constructor Description TableFunction()
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract void
cleanUp()
Perform any necessary clean up tasks.abstract PlanCost
getCost()
Returns the estimated cost of this plan node's operation.abstract Tuple
getNextTuple()
Gets the next tuple that fulfills the conditions for this plan node.abstract Schema
getSchema()
Returns the schema of the results that this node produces.abstract java.util.ArrayList<ColumnStats>
getStats()
Returns statistics (possibly estimated) describing the results that this plan node will produce.abstract void
initialize()
Does any initialization the node might need.abstract 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.abstract 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.
-
-
-
Method Detail
-
resultsOrderedBy
public abstract 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. 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.
- 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.
-
prepare
public abstract 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.
-
getSchema
public abstract Schema getSchema()
Returns the schema of the results that this node produces. Some nodes such as Select will not change the input schema but others, such as Project, Rename, and ThetaJoin, must change it.The schema is not computed until the
prepare()
method is called; until that point, this method will return null.- Returns:
- the schema produced by this plan-node.
-
getCost
public abstract PlanCost getCost()
Returns the estimated cost of this plan node's operation. The estimate depends on which algorithm the node uses and the data it is working with.The cost is not computed until the
prepare()
method is called; until that point, this method will return null.- Returns:
- an object containing various cost measures such as the worst-case number of disk accesses, the number of tuples produced, etc.
-
getStats
public abstract java.util.ArrayList<ColumnStats> getStats()
Returns statistics (possibly estimated) describing the results that this plan node will produce. Estimating statistics for output results is a very imprecise task, to say the least.These statistics are not computed until the
prepare()
method is called; until that point, this method will return null.- Returns:
- statistics describing the results that will be produced by this plan-node.
-
initialize
public abstract void initialize()
Does any initialization the node might need. This could include resetting state variables or starting the node over from the beginning.
-
getNextTuple
public abstract 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.- Returns:
- the next tuple to be generated by this plan, or null if the plan has finished generating plan nodes.
-
cleanUp
public abstract void cleanUp()
Perform any necessary clean up tasks. This should probably be called when we are done with this plan node.
-
-