net.sf.farrago.query
Class FarragoSqlValidator

java.lang.Object
  extended by org.eigenbase.sql.validate.SqlValidatorImpl
      extended by net.sf.farrago.query.FarragoSqlValidator
All Implemented Interfaces:
SqlValidator, SqlValidatorWithHints
Direct Known Subclasses:
LucidDbSqlValidator

public class FarragoSqlValidator
extends SqlValidatorImpl

FarragoSqlValidator refines SqlValidator with some Farrago-specifics.

Version:
$Id: //open/dev/farrago/src/net/sf/farrago/query/FarragoSqlValidator.java#39 $
Author:
John V. Sichi

Nested Class Summary
 
Nested classes/interfaces inherited from class org.eigenbase.sql.validate.SqlValidatorImpl
SqlValidatorImpl.DmlNamespace, SqlValidatorImpl.FunctionParamInfo, SqlValidatorImpl.IdInfo, SqlValidatorImpl.Status
 
Nested classes/interfaces inherited from interface org.eigenbase.sql.validate.SqlValidator
SqlValidator.Compatible
 
Field Summary
(package private)  FarragoPreparingStmt preparingStmt
           
 
Fields inherited from class org.eigenbase.sql.validate.SqlValidatorImpl
expandColumnReferences, expandIdentifiers, functionCallStack, idPositions, namespaces, scopes, tracer, typeFactory, unknownType, UPDATE_ANON_PREFIX, UPDATE_SRC_ALIAS, UPDATE_TGT_ALIAS
 
Constructor Summary
FarragoSqlValidator(FarragoPreparingStmt preparingStmt, SqlConformance conformance)
          Constructor that relies on the preparingStmt object to provide various other objects during initialization.
FarragoSqlValidator(SqlOperatorTable opTab, SqlValidatorCatalogReader catalogReader, RelDataTypeFactory typeFactory, SqlConformance conformance, FarragoPreparingStmt preparingStmt)
          Constructor that allows caller to specify dependant objects rather than relying on the preparingStmt to supply them.
 
Method Summary
protected  FarragoPreparingStmt getPreparingStmt()
           
protected  boolean shouldAllowIntermediateOrderBy()
           
 boolean shouldExpandIdentifiers()
          Returns expansion of identifiers.
 SqlNode validate(SqlNode topNode)
          Validates an expression tree.
 void validateColumnListParams(SqlFunction function, RelDataType[] argTypes, SqlNode[] operands)
          Validates a COLUMN_LIST parameter
 void validateDataType(SqlDataTypeSpec dataType)
          Validates a data type expression.
 void validateDelete(SqlDelete call)
          Validates a DELETE statement.
protected  void validateFeature(org.eigenbase.resgen.ResourceDefinition feature, SqlParserPos context)
          Validates that a particular feature is enabled.
 void validateInsert(SqlInsert call)
          Validates an INSERT statement.
 void validateMerge(SqlMerge call)
          Validates a MERGE statement.
 void validateUpdate(SqlUpdate call)
          Validates an UPDATE statement.
 
Methods inherited from class org.eigenbase.sql.validate.SqlValidatorImpl
addToSelectList, checkTypeAssignment, createSelectNamespace, createSetopNamespace, createSourceSelectForDelete, createSourceSelectForUpdate, createTargetRowType, declareCursor, deriveAlias, deriveConstructorType, deriveType, expand, expandOrderExpr, expandStar, getCatalogReader, getConformance, getCursorScope, getFromScope, getGroupScope, getHavingScope, getJoinScope, getLogicalSourceRowType, getLogicalTargetRowType, getNamespace, getOperatorTable, getOrderScope, getOriginal, getOverScope, getParentCursor, getRawSelectScope, getScope, getSelectScope, getSelfJoinExprForUpdate, getTypeFactory, getUnknownType, getValidatedNodeType, getValidatedNodeTypeIfKnown, getWhereScope, getWindowByName, handleUnresolvedFunction, inferUnknownTypes, isAggregate, isAggregate, isSystemField, lookupHints, lookupNameCompletionHints, lookupQualifiedName, newValidationError, performUnconditionalRewrites, popFunctionCall, pushFunctionCall, registerNamespace, removeValidatedNodeType, resolveWindow, setCallRewrite, setColumnReferenceExpansion, setIdentifierExpansion, setOriginal, setValidatedNodeType, shouldAllowOverRelation, validateAggregateParams, validateCall, validateDynamicParam, validateFrom, validateGroupClause, validateHavingClause, validateIdentifier, validateIntervalQualifier, validateJoin, validateLiteral, validateNamespace, validateOrderList, validateOver, validateParameterizedExpression, validateQuery, validateSelect, validateSelectList, validateValues, validateWhereClause, validateWhereOrOn, validateWindow, validateWindowClause
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

preparingStmt

final FarragoPreparingStmt preparingStmt
Constructor Detail

FarragoSqlValidator

public FarragoSqlValidator(SqlOperatorTable opTab,
                           SqlValidatorCatalogReader catalogReader,
                           RelDataTypeFactory typeFactory,
                           SqlConformance conformance,
                           FarragoPreparingStmt preparingStmt)
Constructor that allows caller to specify dependant objects rather than relying on the preparingStmt to supply them. This constructor is is friendlier to class extension as well as providing more control during test setup.


FarragoSqlValidator

public FarragoSqlValidator(FarragoPreparingStmt preparingStmt,
                           SqlConformance conformance)
Constructor that relies on the preparingStmt object to provide various other objects during initialization.

Method Detail

validate

public SqlNode validate(SqlNode topNode)
Description copied from interface: SqlValidator
Validates an expression tree. You can call this method multiple times, but not reentrantly.

Specified by:
validate in interface SqlValidator
Overrides:
validate in class SqlValidatorImpl
Parameters:
topNode - top of expression tree to be validated
Returns:
validated tree (possibly rewritten)

shouldExpandIdentifiers

public boolean shouldExpandIdentifiers()
Description copied from interface: SqlValidator
Returns expansion of identifiers.

Specified by:
shouldExpandIdentifiers in interface SqlValidator
Overrides:
shouldExpandIdentifiers in class SqlValidatorImpl
Returns:
whether this validator should expand identifiers

shouldAllowIntermediateOrderBy

protected boolean shouldAllowIntermediateOrderBy()
Overrides:
shouldAllowIntermediateOrderBy in class SqlValidatorImpl

validateDataType

public void validateDataType(SqlDataTypeSpec dataType)
Description copied from interface: SqlValidator
Validates a data type expression.

Specified by:
validateDataType in interface SqlValidator
Overrides:
validateDataType in class SqlValidatorImpl
Parameters:
dataType - Data type

getPreparingStmt

protected FarragoPreparingStmt getPreparingStmt()

validateInsert

public void validateInsert(SqlInsert call)
Description copied from interface: SqlValidator
Validates an INSERT statement.

Specified by:
validateInsert in interface SqlValidator
Overrides:
validateInsert in class SqlValidatorImpl
Parameters:
call - INSERT statement

validateUpdate

public void validateUpdate(SqlUpdate call)
Description copied from interface: SqlValidator
Validates an UPDATE statement.

Specified by:
validateUpdate in interface SqlValidator
Overrides:
validateUpdate in class SqlValidatorImpl
Parameters:
call - UPDATE statement

validateDelete

public void validateDelete(SqlDelete call)
Description copied from interface: SqlValidator
Validates a DELETE statement.

Specified by:
validateDelete in interface SqlValidator
Overrides:
validateDelete in class SqlValidatorImpl
Parameters:
call - DELETE statement

validateMerge

public void validateMerge(SqlMerge call)
Description copied from interface: SqlValidator
Validates a MERGE statement.

Specified by:
validateMerge in interface SqlValidator
Overrides:
validateMerge in class SqlValidatorImpl
Parameters:
call - MERGE statement

validateFeature

protected void validateFeature(org.eigenbase.resgen.ResourceDefinition feature,
                               SqlParserPos context)
Description copied from class: SqlValidatorImpl
Validates that a particular feature is enabled. By default, all features are enabled; subclasses may override this method to be more discriminating.

Overrides:
validateFeature in class SqlValidatorImpl
Parameters:
feature - feature being used, represented as a resource definition from EigenbaseResource
context - parser position context for error reporting, or null if none available

validateColumnListParams

public void validateColumnListParams(SqlFunction function,
                                     RelDataType[] argTypes,
                                     SqlNode[] operands)
Description copied from interface: SqlValidator
Validates a COLUMN_LIST parameter

Specified by:
validateColumnListParams in interface SqlValidator
Overrides:
validateColumnListParams in class SqlValidatorImpl
Parameters:
function - function containing COLUMN_LIST parameter
argTypes - function arguments
operands - operands passed into the function call