Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface DeterminismSource
Answers, for a pipeline rule, whether an expression evaluates to the same relation every time it is run.

A rewrite that changes how many times a sub-expression is evaluated needs this. SET-001 collapses R ∪ R to one evaluation of R; SEL-010 turns two reads of A into one. Both are answer-preserving exactly when the expression is reproducible, and X ∆ X over an unseeded SAMPLE is a query about two draws.

It exists as a seam rather than as a direct call because the authoritative answer — RelationDeterminism — resolves views and table-valued functions through a SymbolTable, and no rule in OptimizationPipeline takes one. It is supplied on OptimizationContext alongside the two other per-run lookups and the function catalogue, which is the bundle a rule is already handed; QueryOptimizer.optimize(com.darkcollective.relix.semantic.SemanticModel) binds the model's symbol table into it.

The default is NONE, which answers false for everything. That is the conservative direction — a rule declines to fire — so a caller that supplies none gets a slower plan, never a wrong one, exactly as FunctionCatalog.empty() does for the rules that ask what a function may do.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final DeterminismSource
    A source that vouches for nothing — every expression reads as irreproducible.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns whether evaluating expression twice necessarily gives the same relation.
  • Field Details

    • NONE

      static final DeterminismSource NONE
      A source that vouches for nothing — every expression reads as irreproducible.

      Not "no expression is deterministic", but "this caller cannot say": the rules that consult it decline, which is the same behaviour they have for an expression genuinely known to be volatile.

  • Method Details

    • isDeterministic

      boolean isDeterministic(RelNode expression)
      Returns whether evaluating expression twice necessarily gives the same relation.
      Parameters:
      expression - the sub-expression to classify; never null
      Returns:
      true only when the expression is known to be reproducible