Class EmptyRelation

java.lang.Object
nz.org.riskscape.engine.relation.EmptyRelation
All Implemented Interfaces:
AutoCloseable, SelfDescribingScalarData, Realized, Relation

public class EmptyRelation extends Object implements Relation

A relation that has no values, just a type. Mostly useful for testing.

  • Constructor Details

    • EmptyRelation

      public EmptyRelation(Struct type)
  • Method Details

    • getType

      public Struct getType()
      Specified by:
      getType in interface Relation
    • iterator

      public TupleIterator iterator()
      Specified by:
      iterator in interface Relation
    • project

      public ResultOrProblems<Relation> project(Projection projection)
      Specified by:
      project in interface Relation
    • restrict

      public ResultOrProblems<Relation> restrict(Restriction restriction)
      Specified by:
      restrict in interface Relation
    • skipInvalid

      public Relation skipInvalid(ProblemSink sendProblemsTo)
      Specified by:
      skipInvalid in interface Relation
      Returns:
      a new relation that skips rows that are invalid for some reason TODO consider whether we need some sort of 'cloneWithOptions' method, that returns a new relation if the options are supported
    • getSourceInformation

      public String getSourceInformation()
      Specified by:
      getSourceInformation in interface Relation
    • limitAndOffset

      public Relation limitAndOffset(long newLimit, long newOffset)
      Description copied from interface: Relation

      Returns a new relation that yields a subset of tuples this relation would normally return. This should apply after any filtering that's applied to the relation, even if those filters are applied after a limit and offset.

      Specified by:
      limitAndOffset in interface Relation
      Returns:
      a new Relation with the limit and offset applied
    • getLimit

      public long getLimit()
      Specified by:
      getLimit in interface Relation
      Returns:
      The maximum number of Tuples this Relation will yield via an iterator it produces. If the underlying data set is not ordered, this could be a completely arbitrary set of results.
    • getOffset

      public long getOffset()
      Specified by:
      getOffset in interface Relation
      Returns:
      The number of Tuples that will be skipped before an iterator starts yielding results. If the underlying data set is not ordered, this could be a completely arbitrary set of results.
    • size

      public Optional<Long> size()
      Description copied from interface: Relation

      Get a rough count of the untransformed tuples in the relation. This may include tuples that are skipped because they are invalid or removed by a filter bookmark parameter. A rule of thumb is this should match the number of tuples produced by BaseRelation#rawIterator().

      Specified by:
      size in interface Relation
      Returns:
      the number of tuples present in the underlying data (if easily known).
    • hasSkipOnInvalid

      public boolean hasSkipOnInvalid()
      Specified by:
      hasSkipOnInvalid in interface Relation
      Returns:
      true if invalid rows will be skipped for this relation