Package org.apache.calcite.sql.validate
Interface AggregatingScope
- All Superinterfaces:
SqlValidatorScope
- All Known Implementing Classes:
AggregatingSelectScope
An extension to the
SqlValidatorScope
interface which indicates that
the scope is aggregating.
A scope which is aggregating must implement this interface. Such a scope will return the same set of identifiers as its parent scope, but some of those identifiers may not be accessible because they are not in the GROUP BY clause.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.calcite.sql.validate.SqlValidatorScope
SqlValidatorScope.EmptyPath, SqlValidatorScope.Path, SqlValidatorScope.Resolve, SqlValidatorScope.Resolved, SqlValidatorScope.ResolvedImpl, SqlValidatorScope.Step
-
Method Summary
Modifier and TypeMethodDescriptionboolean
checkAggregateExpr
(SqlNode expr, boolean deep) Checks whether an expression is constant within the GROUP BY clause.Methods inherited from interface org.apache.calcite.sql.validate.SqlValidatorScope
addChild, findAliases, findAllColumnNames, findQualifyingTableName, findQualifyingTableNames, fullyQualify, getMonotonicity, getNode, getOperandScope, getOrderList, getTableNamespace, getValidator, isMeasureRef, isWithin, lookupWindow, nullifyType, resolve, resolveColumn, resolveTable, validateExpr
-
Method Details
-
checkAggregateExpr
Checks whether an expression is constant within the GROUP BY clause. If the expression completely matches an expression in the GROUP BY clause, returns true. If the expression is constant within the group, but does not exactly match, returns false. If the expression is not constant, throws an exception. Examples:- If we are 'f(b, c)' in 'SELECT a + f(b, c) FROM t GROUP BY a', then the whole expression matches a group column. Return true.
- Just an ordinary expression in a GROUP BY query, such as 'f(SUM(a), 1, b)' in 'SELECT f(SUM(a), 1, b) FROM t GROUP BY b'. Returns false.
- Illegal expression, such as 'f(5, a, b)' in 'SELECT f(a, b) FROM t GROUP BY a'. Throws when it enounters the 'b' operand, because it is not in the group clause.
-