Class StatisticsDistinctnessSource
- All Implemented Interfaces:
DistinctnessSource
DistinctnessSource that reads duplicate-freeness off a leaf relation's
declared keys — the base-relation half of the seam, complementing the
generator-backed source that covers Range/Naturals/Primes.
A relation with at least one candidate key in its RelationStatistics
is duplicate-free by definition: a key uniquely identifies a row, so no two rows
can be equal. This is what lets DIST-001 remove a δ applied
directly to a primary-keyed table.
The keys come from wherever the statistics did — for JDBC relations, the
primary key read from DatabaseMetaData.getPrimaryKeys; for inline
relations, single-column uniqueness computed exactly. A relation with statistics
but no declared key reports false: a row count alone says nothing
about duplicates. Sources that are never introspected (CSV, Mongo, HTTP) carry no
statistics at all and so correctly report false.
Leaves only. This answers for a RelationNode as it
stands; distinctness through a projection of a key is a separate and harder
question that PropertyDeriver deliberately does not attempt.
- See Also:
-
Field Summary
Fields inherited from interface com.darkcollective.relix.cost.DistinctnessSource
NONE -
Constructor Summary
ConstructorsConstructorDescriptionStatisticsDistinctnessSource(StatisticsSource statistics) Creates a distinctness source over the given statistics. -
Method Summary
-
Constructor Details
-
StatisticsDistinctnessSource
Creates a distinctness source over the given statistics.- Parameters:
statistics- the per-relation statistics lookup; must not be null (useStatisticsSource.NONEfor none, which makes this source equivalent toDistinctnessSource.NONE)
-
-
Method Details
-
duplicateFreeLeaf
- Specified by:
duplicateFreeLeafin interfaceDistinctnessSource- Parameters:
relationName- the leaf relation name; never null- Returns:
truewhen the named relation has at least one candidate key
-