Package mondrian.rolap.agg
Class AbstractQuerySpec
java.lang.Object
mondrian.rolap.agg.AbstractQuerySpec
- All Implemented Interfaces:
QuerySpec
Base class for
QuerySpec implementations.- Author:
- jhyde, Richard M. Emberson
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractQuerySpec(RolapStar star, boolean countOnly) Creates an AbstractQuerySpec. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddGroupingFunction(SqlQuery sqlQuery) protected voidaddGroupingSets(SqlQuery sqlQuery, Map<String, String> groupingSetsAliases) protected voidaddMeasure(int i, SqlQuery sqlQuery) Adds a measure to a query.distinctGenerateSql(SqlQuery outerSqlQuery, boolean countOnly) Generates a SQL query to retrieve the values in this segment using an algorithm which converts distinct-aggregates to non-distinct aggregates over subqueries.protected voidextraPredicates(SqlQuery sqlQuery) Adds predicates not associated with columns.protected intReturns the number of measures whose aggregation function is distinct-count.protected List<StarPredicate>Returns a list of predicates not associated with a particular column.getStar()protected abstract booleanprotected booleanWhether to add an ORDER BY clause to make results deterministic.protected booleanAllows subclasses to specify if a given column must be returned as part of the result set, in the select clause.protected booleanisPartOfSelect(RolapStar.Measure measure) Allows subclasses to specify if a given column must be returned as part of the result set, in the select clause.protected SqlQueryCreates a query object.nonDistinctGenerateSql(SqlQuery sqlQuery) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface mondrian.rolap.agg.QuerySpec
getColumnAlias, getColumnPredicate, getColumns, getMeasure, getMeasureAlias, getMeasureCount
-
Field Details
-
countOnly
protected final boolean countOnly
-
-
Constructor Details
-
AbstractQuerySpec
Creates an AbstractQuerySpec.- Parameters:
star- Star which defines columns of interest and their relationshipscountOnly- If true, generate no GROUP BY clause, so the query returns a single row containing a grand total
-
-
Method Details
-
newSqlQuery
Creates a query object.- Returns:
- a new query object
-
getStar
-
addMeasure
Adds a measure to a query.- Parameters:
i- Ordinal of measuresqlQuery- Query object
-
isAggregate
protected abstract boolean isAggregate() -
nonDistinctGenerateSql
-
isPartOfSelect
Allows subclasses to specify if a given column must be returned as part of the result set, in the select clause. -
isPartOfSelect
Allows subclasses to specify if a given column must be returned as part of the result set, in the select clause. -
isOrdered
protected boolean isOrdered()Whether to add an ORDER BY clause to make results deterministic. Necessary if query returns more than one row and results are for human consumption.- Returns:
- whether to sort query
-
generateSqlQuery
- Specified by:
generateSqlQueryin interfaceQuerySpec
-
addGroupingFunction
-
addGroupingSets
-
getDistinctMeasureCount
protected int getDistinctMeasureCount()Returns the number of measures whose aggregation function is distinct-count.- Returns:
- Number of distinct-count measures
-
distinctGenerateSql
Generates a SQL query to retrieve the values in this segment using an algorithm which converts distinct-aggregates to non-distinct aggregates over subqueries.- Parameters:
outerSqlQuery- Query to modifycountOnly- If true, only generate a single row: no need to generate a GROUP BY clause or put any constraining columns in the SELECT clause- Returns:
- A map of aliases used in the inner query if grouping sets were enabled.
-
extraPredicates
Adds predicates not associated with columns.- Parameters:
sqlQuery- Query
-
getPredicateList
Returns a list of predicates not associated with a particular column.- Returns:
- list of non-column predicates
-