Class Snapshot

All Implemented Interfaces:
Cloneable, RelOptNode, Hintable, RelNode
Direct Known Subclasses:
LogicalSnapshot

public abstract class Snapshot extends SingleRel implements Hintable
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 Details

    • hints

      protected final com.google.common.collect.ImmutableList<RelHint> hints
  • Constructor Details

    • Snapshot

      public Snapshot(RelInput input)
      Creates a Snapshot by parsing serialized output.
    • Snapshot

      protected Snapshot(RelOptCluster cluster, RelTraitSet traitSet, List<RelHint> hints, RelNode input, RexNode period)
      Creates a Snapshot.
      Parameters:
      cluster - Cluster that this relational expression belongs to
      traitSet - The traits of this relational expression
      hints - Hints for this node
      input - Input relational expression
      period - Timestamp expression which as the table was at the given time in the past
    • 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 Details

    • copy

      public final RelNode copy(RelTraitSet traitSet, 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
    • copy

      public abstract Snapshot copy(RelTraitSet traitSet, RelNode input, RexNode period)
    • 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
    • explainTerms

      public RelWriter explainTerms(RelWriter pw)
      Description copied from class: AbstractRelNode
      Describes the inputs and attributes of this relational expression. Each node should call super.explainTerms, then call the RelWriter.input(String, RelNode) and RelWriter.item(String, Object) methods for each input and attribute.
      Overrides:
      explainTerms in class SingleRel
      Parameters:
      pw - Plan writer
      Returns:
      Plan writer for fluent-explain pattern
    • getPeriod

      public RexNode getPeriod()
    • isValid

      public boolean isValid(Litmus litmus, @Nullable 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
    • getHints

      public com.google.common.collect.ImmutableList<RelHint> getHints()
      Description copied from interface: Hintable
      Returns the hints of this relational expressions as an immutable list.
      Specified by:
      getHints in interface Hintable