Class BoundednessChecker

java.lang.Object
com.darkcollective.relix.cost.BoundednessChecker

public final class BoundednessChecker extends Object
Materialisation-safety check: a blocking operator — one that must buffer its whole input before emitting any row — over a provably unbounded input is a plan-time error.

The blocking/streaming split is already a first-class property: RelNode.materializationMode() is non-MaterializationMode.STREAM (i.e. BAG/SET/SORTED) for exactly the operators that accumulate their input — γ, τ, ∀, OPTIMIZE, TOP, reservoir SAMPLE, ⊎, ÷, ⟗, and the set operations ∪/∩/−/∆ and transitive closure. Streaming operators (σ, π, λ, δ, most joins, …) may consume an unbounded input forever and are never flagged.

Boundedness is derived by PropertyDeriver.boundedness(com.darkcollective.relix.ast.RelNode, com.darkcollective.relix.cost.BoundednessSource); because no operator ever produces UNBOUNDED (it originates only at a leaf and λ bounds it), a tree whose leaves are all Boundedness.BOUNDED never trips this check — only a query reading an unbounded generator (Naturals, Primes) or a streaming source can trigger it.

Boundedness.UNKNOWN inputs are not flagged — only what is provably unbounded.

  • Method Details

    • check

      public static List<String> check(RelNode root, BoundednessSource source)
      Checks the tree rooted at root for blocking operators over unbounded inputs.
      Parameters:
      root - the tree to check; must not be null
      source - the per-leaf boundedness lookup; must not be null
      Returns:
      one diagnostic per offending (blocking operator, unbounded input) pair, in pre-order; empty when the tree is materialisation-safe