Package org.apache.calcite.rel.core
Class Snapshot
java.lang.Object
org.apache.calcite.rel.AbstractRelNode
org.apache.calcite.rel.SingleRel
org.apache.calcite.rel.core.Snapshot
- All Implemented Interfaces:
Cloneable
,RelOptNode
,RelNode
- Direct Known Subclasses:
LogicalSnapshot
public abstract class Snapshot extends SingleRel
Relational expression that returns the contents of a relation expression as
it was at a given time in the past.
For example, if Products
is a temporal table, and
TableScan
(Products) is a relational operator that returns all
versions of the contents of the table, then
Snapshot
(TableScan(Products)) is a relational operator that only
returns the contents whose versions that overlap with the given specific
period (i.e. those that started before given period and ended after it).
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
Constructors Modifier Constructor Description protected
Snapshot(RelOptCluster cluster, RelTraitSet traitSet, RelNode input, RexNode period)
Creates a Snapshot. -
Method Summary
Modifier and Type Method Description RelNode
accept(RexShuttle shuttle)
Accepts a visit from a shuttle.RelNode
copy(RelTraitSet traitSet, List<RelNode> inputs)
Creates a copy of this relational expression, perhaps changing traits and inputs.abstract Snapshot
copy(RelTraitSet traitSet, RelNode input, RexNode period)
RelWriter
explainTerms(RelWriter pw)
Describes the inputs and attributes of this relational expression.RexNode
getPeriod()
boolean
isValid(Litmus litmus, RelNode.Context context)
Returns whether this relational expression is valid.Methods inherited from class org.apache.calcite.rel.SingleRel
childrenAccept, deriveRowType, estimateRowCount, getInput, getInputs, replaceInput
Methods inherited from class org.apache.calcite.rel.AbstractRelNode
accept, collectVariablesSet, collectVariablesUsed, computeSelfCost, deepEquals, deepHashCode, equals, explain, getCluster, getConvention, getCorrelVariable, getDescription, getDigest, getExpectedInputRowType, getId, getInput, getRelDigest, getRelTypeName, getRowType, getTable, getTraitSet, getVariablesSet, hashCode, isEnforcer, metadata, onRegister, recomputeDigest, register, sole, toString
-
Constructor Details
-
Snapshot
Creates a Snapshot.- Parameters:
cluster
- Cluster that this relational expression belongs totraitSet
- The traits of this relational expressioninput
- Input relational expressionperiod
- Timestamp expression which as the table was at the given time in the past
-
-
Method Details
-
copy
Description copied from interface:RelNode
Creates a copy of this relational expression, perhaps changing traits and inputs.Sub-classes with other important attributes are encouraged to create variants of this method with more parameters.
- Specified by:
copy
in interfaceRelNode
- Overrides:
copy
in classAbstractRelNode
- Parameters:
traitSet
- Trait setinputs
- Inputs- Returns:
- Copy of this relational expression, substituting traits and inputs
-
copy
-
accept
Description copied from interface:RelNode
Accepts a visit from a shuttle. If the shuttle updates expression, then a copy of the relation should be created. This new relation might have a different row-type.- Specified by:
accept
in interfaceRelNode
- Overrides:
accept
in classAbstractRelNode
- Parameters:
shuttle
- Shuttle- Returns:
- A copy of this node incorporating changes made by the shuttle to this node's children
-
explainTerms
Description copied from class:AbstractRelNode
Describes the inputs and attributes of this relational expression. Each node should callsuper.explainTerms
, then call theRelWriter.input(String, RelNode)
andRelWriterImpl.item(String, Object)
methods for each input and attribute.- Overrides:
explainTerms
in classSingleRel
- Parameters:
pw
- Plan writer- Returns:
- Plan writer for fluent-explain pattern
-
getPeriod
-
isValid
Description copied from interface:RelNode
Returns whether this relational expression is valid.If assertions are enabled, this method is typically called with
litmus
=THROW
, as follows:assert rel.isValid(Litmus.THROW)
This signals that the method can throw an
AssertionError
if it is not valid.- Specified by:
isValid
in interfaceRelNode
- Overrides:
isValid
in classAbstractRelNode
- Parameters:
litmus
- What to do if invalidcontext
- Context for validity checking- Returns:
- Whether relational expression is valid
-