Class DruidSqlValidator

java.lang.Object
org.apache.calcite.sql.validate.SqlValidatorImpl
org.apache.calcite.prepare.CalciteSqlValidator
org.apache.calcite.prepare.BaseDruidSqlValidator
org.apache.druid.sql.calcite.planner.DruidSqlValidator
All Implemented Interfaces:
org.apache.calcite.sql.validate.SqlValidator, org.apache.calcite.sql.validate.SqlValidatorWithHints

public class DruidSqlValidator extends BaseDruidSqlValidator
Druid extended SQL validator. (At present, it doesn't actually have any extensions yet, but it will soon.)
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.apache.calcite.sql.validate.SqlValidatorImpl

    org.apache.calcite.sql.validate.SqlValidatorImpl.DmlNamespace, org.apache.calcite.sql.validate.SqlValidatorImpl.FunctionParamInfo, org.apache.calcite.sql.validate.SqlValidatorImpl.IdInfo, org.apache.calcite.sql.validate.SqlValidatorImpl.Status

    Nested classes/interfaces inherited from interface org.apache.calcite.sql.validate.SqlValidator

    org.apache.calcite.sql.validate.SqlValidator.Config
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     

    Fields inherited from class org.apache.calcite.sql.validate.SqlValidatorImpl

    callToOperandTypesMap, functionCallStack, idPositions, namespaces, scopes, timeFrameSet, TRACER, typeFactory, unknownType, UPDATE_ANON_PREFIX, UPDATE_SRC_ALIAS, UPDATE_TGT_ALIAS
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    DruidSqlValidator(org.apache.calcite.sql.SqlOperatorTable opTab, org.apache.calcite.prepare.CalciteCatalogReader catalogReader, org.apache.calcite.adapter.java.JavaTypeFactory typeFactory, org.apache.calcite.sql.validate.SqlValidator.Config validatorConfig, PlannerContext plannerContext)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.apache.calcite.runtime.CalciteContextException
    buildCalciteContextException(String message, org.apache.calcite.sql.SqlNode call)
     
    static org.apache.calcite.runtime.CalciteContextException
    buildCalciteContextException(Throwable t, String message, org.apache.calcite.sql.SqlNode call)
     
    protected void
    checkTypeAssignment(@Nullable org.apache.calcite.sql.validate.SqlValidatorScope sourceScope, org.apache.calcite.sql.validate.SqlValidatorTable table, org.apache.calcite.rel.type.RelDataType sourceRowType, org.apache.calcite.rel.type.RelDataType targetRowType, org.apache.calcite.sql.SqlNode query)
     
    protected org.apache.calcite.rel.type.RelDataType
    computeTypeForDefinedCol(DatasourceFacade.ColumnFacade definedCol, org.apache.calcite.rel.type.RelDataTypeField sourceField)
     
    protected org.apache.calcite.sql.validate.SelectNamespace
    createSelectNamespace(org.apache.calcite.sql.SqlSelect select, org.apache.calcite.sql.SqlNode enclosingNode)
     
    protected org.apache.calcite.sql.SqlNode
    performUnconditionalRewrites(org.apache.calcite.sql.SqlNode node, boolean underFrom)
     
    void
    validateCall(org.apache.calcite.sql.SqlCall call, org.apache.calcite.sql.validate.SqlValidatorScope scope)
     
    protected void
    validateHavingClause(org.apache.calcite.sql.SqlSelect select)
     
    void
    validateInsert(org.apache.calcite.sql.SqlInsert insert)
    Most of the implementation here is copied over from SqlValidator.validateInsert(SqlInsert) we've extended, refactored, and extracted methods, to fit out needs, and added comments where appropriate.
    void
    validateWindow(org.apache.calcite.sql.SqlNode windowOrId, org.apache.calcite.sql.validate.SqlValidatorScope scope, @Nullable org.apache.calcite.sql.SqlCall call)
     
    protected void
    validateWindowClause(org.apache.calcite.sql.SqlSelect select)
     

    Methods inherited from class org.apache.calcite.prepare.CalciteSqlValidator

    getLogicalSourceRowType, getLogicalTargetRowType

    Methods inherited from class org.apache.calcite.sql.validate.SqlValidatorImpl

    addToSelectList, config, createMatchRecognizeNameSpace, createPivotNameSpace, createSetopNamespace, createSourceSelectForDelete, createSourceSelectForUpdate, createTargetRowType, createUnpivotNameSpace, declareCursor, deriveAlias, deriveConstructorType, deriveType, expand, expandOrderExpr, expandSelectExpr, expandStar, extendedExpandGroupBy, getAggregate, getCatalogReader, getConformance, getCursorScope, getEmptyScope, getFieldOrigins, getFromScope, getGroupScope, getHavingScope, getJoinScope, getLambdaScope, getMatchRecognizeScope, getNamespace, getOperatorTable, getOrderScope, getOriginal, getOverScope, getParameterRowType, getParentCursor, getRawSelectScope, getSelectScope, getSelfJoinExprForUpdate, getTimeFrameSet, getTypeCoercion, getTypeFactory, getUnknownType, getValidatedNodeType, getValidatedNodeTypeIfKnown, getValidatedOperandTypes, getValidationErrorFunction, getWhereScope, getWindowByName, getWithScope, handleUnresolvedFunction, inferUnknownTypes, isAggregate, isAggregate, isNestedAggregateWindow, isOverAggregateWindow, isSystemField, lookupHints, lookupNameCompletionHints, lookupQualifiedName, makeNullaryCall, newValidationError, popFunctionCall, pushFunctionCall, registerNamespace, registerQuery, removeValidatedNodeType, resolveLiteral, resolveWindow, setOriginal, setValidatedNodeType, shouldAllowIntermediateOrderBy, shouldAllowOverRelation, transform, usingNames, validate, validateAggregateParams, validateDataType, validateDelete, validateDynamicParam, validateFeature, validateFrom, validateGroupClause, validateIdentifier, validateIntervalQualifier, validateJoin, validateLambda, validateLiteral, validateMatchRecognize, validateMerge, validateModality, validateNamespace, validateOrderList, validateOver, validateParameterizedExpression, validatePivot, validateQualifyClause, validateQuery, validateSelect, validateSelectList, validateSequenceValue, validateTableFunction, validateTimeFrame, validateUnnest, validateUnpivot, validateUpdate, validateValues, validateWhereClause, validateWhereOrOn, validateWith, validateWithItem

    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.SqlValidator

    getTypeMappingRule, resolveWindow
  • Field Details

  • Constructor Details

    • DruidSqlValidator

      protected DruidSqlValidator(org.apache.calcite.sql.SqlOperatorTable opTab, org.apache.calcite.prepare.CalciteCatalogReader catalogReader, org.apache.calcite.adapter.java.JavaTypeFactory typeFactory, org.apache.calcite.sql.validate.SqlValidator.Config validatorConfig, PlannerContext plannerContext)
  • Method Details

    • validateWindow

      public void validateWindow(org.apache.calcite.sql.SqlNode windowOrId, org.apache.calcite.sql.validate.SqlValidatorScope scope, @Nullable org.apache.calcite.sql.SqlCall call)
      Specified by:
      validateWindow in interface org.apache.calcite.sql.validate.SqlValidator
      Overrides:
      validateWindow in class org.apache.calcite.sql.validate.SqlValidatorImpl
    • validateInsert

      public void validateInsert(org.apache.calcite.sql.SqlInsert insert)
      Most of the implementation here is copied over from SqlValidator.validateInsert(SqlInsert) we've extended, refactored, and extracted methods, to fit out needs, and added comments where appropriate.
      Specified by:
      validateInsert in interface org.apache.calcite.sql.validate.SqlValidator
      Overrides:
      validateInsert in class org.apache.calcite.sql.validate.SqlValidatorImpl
      Parameters:
      insert - INSERT statement
    • createSelectNamespace

      protected org.apache.calcite.sql.validate.SelectNamespace createSelectNamespace(org.apache.calcite.sql.SqlSelect select, org.apache.calcite.sql.SqlNode enclosingNode)
      Overrides:
      createSelectNamespace in class org.apache.calcite.sql.validate.SqlValidatorImpl
    • checkTypeAssignment

      protected void checkTypeAssignment(@Nullable org.apache.calcite.sql.validate.SqlValidatorScope sourceScope, org.apache.calcite.sql.validate.SqlValidatorTable table, org.apache.calcite.rel.type.RelDataType sourceRowType, org.apache.calcite.rel.type.RelDataType targetRowType, org.apache.calcite.sql.SqlNode query)
      Overrides:
      checkTypeAssignment in class org.apache.calcite.sql.validate.SqlValidatorImpl
    • computeTypeForDefinedCol

      protected org.apache.calcite.rel.type.RelDataType computeTypeForDefinedCol(DatasourceFacade.ColumnFacade definedCol, org.apache.calcite.rel.type.RelDataTypeField sourceField)
    • validateCall

      public void validateCall(org.apache.calcite.sql.SqlCall call, org.apache.calcite.sql.validate.SqlValidatorScope scope)
      Specified by:
      validateCall in interface org.apache.calcite.sql.validate.SqlValidator
      Overrides:
      validateCall in class org.apache.calcite.sql.validate.SqlValidatorImpl
    • validateWindowClause

      protected void validateWindowClause(org.apache.calcite.sql.SqlSelect select)
      Overrides:
      validateWindowClause in class org.apache.calcite.sql.validate.SqlValidatorImpl
    • performUnconditionalRewrites

      protected org.apache.calcite.sql.SqlNode performUnconditionalRewrites(org.apache.calcite.sql.SqlNode node, boolean underFrom)
      Overrides:
      performUnconditionalRewrites in class org.apache.calcite.sql.validate.SqlValidatorImpl
    • buildCalciteContextException

      public static org.apache.calcite.runtime.CalciteContextException buildCalciteContextException(String message, org.apache.calcite.sql.SqlNode call)
    • buildCalciteContextException

      public static org.apache.calcite.runtime.CalciteContextException buildCalciteContextException(Throwable t, String message, org.apache.calcite.sql.SqlNode call)
    • validateHavingClause

      protected void validateHavingClause(org.apache.calcite.sql.SqlSelect select)
      Overrides:
      validateHavingClause in class org.apache.calcite.sql.validate.SqlValidatorImpl