Package com.darkcollective.relix.cost
Interface StatisticsSource
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Supplies
RelationStatistics for a leaf relation by name, the seam
through which the CostEstimator obtains cardinality metadata.
Implementations decide how a relation name maps to statistics (typically by
resolving the name to a symbol and consulting a statistics map collected during
semantic analysis). The default NONE resolves nothing, which makes the
estimator fall back to its tier-based heuristics.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StatisticsSourceA source that knows nothing about any relation. -
Method Summary
Modifier and TypeMethodDescriptionforRelation(String relationName) Returns the statistics for the relation namedrelationName, orOptional.empty()if none are available.static StatisticsSourceof(SymbolTable symbols, Map<String, RelationStatistics> statistics) Creates a source that resolves an expression-tree relation name throughsymbolsand looks the resulting canonical name up instatistics— the standard resolution for statistics collected during semantic analysis (as inSemanticModel.statistics()), which are keyed by canonical name while aRelationNodecarries the name as written.
-
Field Details
-
NONE
A source that knows nothing about any relation.
-
-
Method Details
-
forRelation
Returns the statistics for the relation namedrelationName, orOptional.empty()if none are available.- Parameters:
relationName- the relation name as it appears in the expression tree- Returns:
- the statistics, or empty if unknown
-
of
Creates a source that resolves an expression-tree relation name throughsymbolsand looks the resulting canonical name up instatistics— the standard resolution for statistics collected during semantic analysis (as inSemanticModel.statistics()), which are keyed by canonical name while aRelationNodecarries the name as written.Shared by every consumer of analysis-time statistics — the planner, the optimizer's cost estimator, and
StatisticsDistinctnessSource— so the name-to-statistics mapping has exactly one definition.- Parameters:
symbols- the symbol table resolving names to symbols; must not be nullstatistics- canonical relation name → statistics; must not be null- Returns:
- a source over
statistics; never null
-