Class Snapshot

  • All Implemented Interfaces:
    java.lang.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).

    • Field Detail

      • period

        private final RexNode period
    • Constructor Detail

      • Snapshot

        protected Snapshot​(RelOptCluster cluster,
                           RelTraitSet traitSet,
                           RelNode input,
                           RexNode period)
        Creates a Snapshot.
        Parameters:
        cluster - Cluster that this relational expression belongs to
        traitSet - The traits of this relational expression
        input - Input relational expression
        period - Timestamp expression which as the table was at the given time in the past
    • Method Detail

      • copy

        public final RelNode copy​(RelTraitSet traitSet,
                                  java.util.List<RelNode> inputs)
        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 interface RelNode
        Overrides:
        copy in class AbstractRelNode
        Parameters:
        traitSet - Trait set
        inputs - Inputs
        Returns:
        Copy of this relational expression, substituting traits and inputs
      • getChildExps

        public java.util.List<RexNode> getChildExps()
        Description copied from interface: RelNode
        Returns a list of this relational expression's child expressions. (These are scalar expressions, and so do not include the relational inputs that are returned by RelNode.getInputs().

        The caller should treat the list as unmodifiable; typical implementations will return an immutable list. If there are no child expressions, returns an empty list, not null.

        Specified by:
        getChildExps in interface RelNode
        Overrides:
        getChildExps in class AbstractRelNode
        Returns:
        List of this relational expression's child expressions
        See Also:
        RelNode.accept(org.apache.calcite.rex.RexShuttle)
      • accept

        public RelNode accept​(RexShuttle shuttle)
        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 interface RelNode
        Overrides:
        accept in class AbstractRelNode
        Parameters:
        shuttle - Shuttle
        Returns:
        A copy of this node incorporating changes made by the shuttle to this node's children
      • getPeriod

        public RexNode getPeriod()
      • isValid

        public boolean isValid​(Litmus litmus,
                               RelNode.Context context)
        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 interface RelNode
        Overrides:
        isValid in class AbstractRelNode
        Parameters:
        litmus - What to do if invalid
        context - Context for validity checking
        Returns:
        Whether relational expression is valid