Package mondrian.spi.impl
Class SqlStatisticsProvider
java.lang.Object
mondrian.spi.impl.SqlStatisticsProvider
- All Implemented Interfaces:
StatisticsProvider
Implementation of
StatisticsProvider
that generates
SQL queries to count rows and distinct values.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionlong
getColumnCardinality
(Dialect dialect, DataSource dataSource, String catalog, String schema, String table, String column, Execution execution) Returns an estimate of the number of rows in a table.long
getQueryCardinality
(Dialect dialect, DataSource dataSource, String sql, Execution execution) Returns an estimate of the number of rows returned by a query.long
getTableCardinality
(Dialect dialect, DataSource dataSource, String catalog, String schema, String table, Execution execution) Returns an estimate of the number of rows in a table.
-
Constructor Details
-
SqlStatisticsProvider
public SqlStatisticsProvider()
-
-
Method Details
-
getTableCardinality
public long getTableCardinality(Dialect dialect, DataSource dataSource, String catalog, String schema, String table, Execution execution) Description copied from interface:StatisticsProvider
Returns an estimate of the number of rows in a table.- Specified by:
getTableCardinality
in interfaceStatisticsProvider
- Parameters:
dialect
- DialectdataSource
- Data sourcecatalog
- Catalog nameschema
- Schema nametable
- Table nameexecution
- Execution- Returns:
- Estimated number of rows in table, or -1 if there is no estimate
-
getQueryCardinality
public long getQueryCardinality(Dialect dialect, DataSource dataSource, String sql, Execution execution) Description copied from interface:StatisticsProvider
Returns an estimate of the number of rows returned by a query.- Specified by:
getQueryCardinality
in interfaceStatisticsProvider
- Parameters:
dialect
- DialectdataSource
- Data sourcesql
- Query, e.g. "select * from customers where age < 20"execution
- Execution- Returns:
- Estimated number of rows returned by query, or -1 if there is no estimate
-
getColumnCardinality
public long getColumnCardinality(Dialect dialect, DataSource dataSource, String catalog, String schema, String table, String column, Execution execution) Description copied from interface:StatisticsProvider
Returns an estimate of the number of rows in a table.- Specified by:
getColumnCardinality
in interfaceStatisticsProvider
- Parameters:
dialect
- DialectdataSource
- Data sourcecatalog
- Catalog nameschema
- Schema nametable
- Table namecolumn
- Column nameexecution
- Execution- Returns:
- Estimated number of rows in table, or -1 if there is no estimate
-