Interface DistinctnessSource
- All Known Implementing Classes:
GeneratorDistinctnessSource,StatisticsDistinctnessSource
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
BoundednessSource.
PropertyDeriver derives distinctness structurally for operators, but a
leaf RelationNode is conservatively non-distinct unless a source says
otherwise — a generator that declares itself duplicate-free (Range,
Naturals, Primes), or a base relation with a declared key
(StatisticsDistinctnessSource). Both kinds are consulted together via
anyOf(DistinctnessSource...). The default NONE reports nothing
as distinct, so it is a safe no-op where no producer is wired in.
Used by DistinctEliminationPass (DIST-001): δ(R) → R when R
is duplicate-free — which, for an unbounded distinct generator, also dissolves the
δ unbounded-retained-state hazard.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DistinctnessSourceA source under which no leaf is known to be duplicate-free. -
Method Summary
Modifier and TypeMethodDescriptionstatic DistinctnessSourceanyOf(DistinctnessSource... sources) Combines several sources into one that reports a leaf duplicate-free when any constituent does — the correct composition, since each source knows about a disjoint kind of leaf (a generator declares itself distinct; a base relation is distinct by virtue of a declared key) and none can refute another's claim.booleanduplicateFreeLeaf(String relationName)
-
Field Details
-
NONE
A source under which no leaf is known to be duplicate-free.
-
-
Method Details
-
duplicateFreeLeaf
- Parameters:
relationName- the leaf relation name; never null- Returns:
trueif that leaf is inherently duplicate-free
-
anyOf
Combines several sources into one that reports a leaf duplicate-free when any constituent does — the correct composition, since each source knows about a disjoint kind of leaf (a generator declares itself distinct; a base relation is distinct by virtue of a declared key) and none can refute another's claim.Sources are consulted in order and the scan short-circuits on the first
true. With no arguments the result isNONE.- Parameters:
sources- the sources to combine; must not be null, nor contain null- Returns:
- a source reporting the disjunction of its constituents; never null
-