Package org.apache.calcite.statistic
Class CachingSqlStatisticProvider
java.lang.Object
org.apache.calcite.statistic.CachingSqlStatisticProvider
- All Implemented Interfaces:
SqlStatisticProvider
Implementation of
SqlStatisticProvider that reads and writes a
cache.-
Constructor Summary
ConstructorsConstructorDescriptionCachingSqlStatisticProvider(SqlStatisticProvider provider, com.google.common.cache.Cache<List, Object> cache) -
Method Summary
Modifier and TypeMethodDescriptionbooleanisForeignKey(RelOptTable fromTable, List<Integer> fromColumns, RelOptTable toTable, List<Integer> toColumns) Returns whether a join is a foreign key; that is, whether every row in the referencing table is matched by at least one row in the referenced table.booleanisKey(RelOptTable table, List<Integer> columns) Returns whether a collection of columns is a unique (or primary) key.doubletableCardinality(RelOptTable table) Returns an estimate of the number of rows intable.
-
Constructor Details
-
CachingSqlStatisticProvider
public CachingSqlStatisticProvider(SqlStatisticProvider provider, com.google.common.cache.Cache<List, Object> cache)
-
-
Method Details
-
tableCardinality
Description copied from interface:SqlStatisticProviderReturns an estimate of the number of rows intable.- Specified by:
tableCardinalityin interfaceSqlStatisticProvider
-
isForeignKey
public boolean isForeignKey(RelOptTable fromTable, List<Integer> fromColumns, RelOptTable toTable, List<Integer> toColumns) Description copied from interface:SqlStatisticProviderReturns whether a join is a foreign key; that is, whether every row in the referencing table is matched by at least one row in the referenced table.For example,
isForeignKey(EMP, [DEPTNO], DEPT, [DEPTNO])returns true.To change "at least one" to "exactly one", you also need to call
SqlStatisticProvider.isKey(org.apache.calcite.plan.RelOptTable, java.util.List<java.lang.Integer>).- Specified by:
isForeignKeyin interfaceSqlStatisticProvider
-
isKey
Description copied from interface:SqlStatisticProviderReturns whether a collection of columns is a unique (or primary) key.For example,
isKey(EMP, [DEPTNO]returns true;isKey(DEPT, [DEPTNO]returns false.- Specified by:
isKeyin interfaceSqlStatisticProvider
-