Package org.apache.calcite.sql.validate
Class MeasureScope
java.lang.Object
org.apache.calcite.sql.validate.DelegatingScope
org.apache.calcite.sql.validate.MeasureScope
- All Implemented Interfaces:
SqlValidatorScope
Scope for resolving identifiers within a SELECT item that is annotated
"AS MEASURE".
Scope includes the identifiers of SELECT plus all aliases. This allows measures to reference each other and also reference other SELECT items.
-
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
-
Field Summary
Fields inherited from class org.apache.calcite.sql.validate.DelegatingScope
parent, resolved, validator
-
Method Summary
Modifier and TypeMethodDescriptionfullyQualify
(SqlIdentifier identifier) Converts an identifier into a fully-qualified identifier.getNode()
Returns the root node of this scope.@Nullable SqlNode
lookupMeasure
(String name) @Nullable RelDataType
resolveColumn
(String name, SqlNode ctx) Resolves a single identifier to a column, and returns the datatype of that column.void
validateExpr
(SqlNode expr) Performs any scope-specific validation of an expression.Methods inherited from class org.apache.calcite.sql.validate.DelegatingScope
addChild, addColumnNames, analyze, findAliases, findAllColumnNames, findQualifyingTableName, findQualifyingTableNames, getMonotonicity, getOperandScope, getOrderList, getParent, getTableNamespace, getValidator, lookupWindow, nullifyType, qualifyUsingAlias, resolve, resolveTable
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.calcite.sql.validate.SqlValidatorScope
isMeasureRef, isWithin
-
Method Details
-
getNode
Description copied from interface:SqlValidatorScope
Returns the root node of this scope. Never null. -
validateExpr
Description copied from interface:SqlValidatorScope
Performs any scope-specific validation of an expression. For example, an aggregating scope requires that expressions are valid aggregations. The expression has already been validated.- Specified by:
validateExpr
in interfaceSqlValidatorScope
- Overrides:
validateExpr
in classDelegatingScope
-
resolveColumn
Description copied from interface:SqlValidatorScope
Resolves a single identifier to a column, and returns the datatype of that column.If it cannot find the column, returns null. If the column is ambiguous, throws an error with context
ctx
.- Specified by:
resolveColumn
in interfaceSqlValidatorScope
- Overrides:
resolveColumn
in classDelegatingScope
- Parameters:
name
- Name of columnctx
- Context for exception- Returns:
- Type of column, if found and unambiguous; null if not found
-
lookupMeasure
-
fullyQualify
Description copied from class:DelegatingScope
Converts an identifier into a fully-qualified identifier. For example, the "empno" in "select empno from emp natural join dept" becomes "emp.empno".If the identifier cannot be resolved, throws. Never returns null.
- Specified by:
fullyQualify
in interfaceSqlValidatorScope
- Overrides:
fullyQualify
in classDelegatingScope
- Returns:
- A qualified identifier, never null
-