Class FlinkCalciteSqlValidator

  • All Implemented Interfaces:
    org.apache.calcite.sql.validate.SqlValidator, org.apache.calcite.sql.validate.SqlValidatorWithHints

    @Internal
    public final class FlinkCalciteSqlValidator
    extends SqlValidatorImpl
    Extends Calcite's SqlValidator by Flink-specific behavior.
    • Constructor Detail

      • FlinkCalciteSqlValidator

        public FlinkCalciteSqlValidator​(org.apache.calcite.sql.SqlOperatorTable opTab,
                                        org.apache.calcite.sql.validate.SqlValidatorCatalogReader catalogReader,
                                        org.apache.calcite.rel.type.RelDataTypeFactory typeFactory,
                                        org.apache.calcite.sql.validate.SqlValidator.Config config,
                                        org.apache.calcite.plan.RelOptTable.ToRelContext toRelcontext,
                                        org.apache.calcite.plan.RelOptCluster relOptCluster,
                                        org.apache.calcite.tools.FrameworkConfig frameworkConfig)
    • Method Detail

      • setExpectedOutputType

        public void setExpectedOutputType​(org.apache.calcite.sql.SqlNode sqlNode,
                                          org.apache.calcite.rel.type.RelDataType expectedOutputType)
      • getExpectedOutputType

        public Optional<org.apache.calcite.rel.type.RelDataType> getExpectedOutputType​(org.apache.calcite.sql.SqlNode sqlNode)
      • validateLiteral

        public void validateLiteral​(org.apache.calcite.sql.SqlLiteral literal)
        Specified by:
        validateLiteral in interface org.apache.calcite.sql.validate.SqlValidator
        Overrides:
        validateLiteral in class SqlValidatorImpl
      • validateColumnListParams

        public void validateColumnListParams​(org.apache.calcite.sql.SqlFunction function,
                                             List<org.apache.calcite.rel.type.RelDataType> argTypes,
                                             List<org.apache.calcite.sql.SqlNode> operands)
        Specified by:
        validateColumnListParams in interface org.apache.calcite.sql.validate.SqlValidator
        Overrides:
        validateColumnListParams in class SqlValidatorImpl
      • registerNamespace

        protected void registerNamespace​(@Nullable org.apache.calcite.sql.validate.SqlValidatorScope usingScope,
                                         @Nullable String alias,
                                         org.apache.calcite.sql.validate.SqlValidatorNamespace ns,
                                         boolean forceNullable)
        Description copied from class: SqlValidatorImpl
        Registers a new namespace, and adds it as a child of its parent scope. Derived class can override this method to tinker with namespaces as they are created.
        Overrides:
        registerNamespace in class SqlValidatorImpl
        Parameters:
        usingScope - Parent scope (which will want to look for things in this namespace)
        alias - Alias by which parent will refer to this namespace
        ns - Namespace
        forceNullable - Whether to force the type of namespace to be nullable
      • addToSelectList

        protected void addToSelectList​(List<org.apache.calcite.sql.SqlNode> list,
                                       Set<String> aliases,
                                       List<Map.Entry<String,​org.apache.calcite.rel.type.RelDataType>> fieldList,
                                       org.apache.calcite.sql.SqlNode exp,
                                       org.apache.calcite.sql.validate.SelectScope scope,
                                       boolean includeSystemVars)
        Description copied from class: SqlValidatorImpl
        Adds an expression to a select list, ensuring that its alias does not clash with any existing expressions on the list.
        Overrides:
        addToSelectList in class SqlValidatorImpl
      • performUnconditionalRewrites

        protected @PolyNull org.apache.calcite.sql.SqlNode performUnconditionalRewrites​(@PolyNull org.apache.calcite.sql.SqlNode node,
                                                                                        boolean underFrom)
        Description copied from class: SqlValidatorImpl
        Performs expression rewrites which are always used unconditionally. These rewrites massage the expression tree into a standard form so that the rest of the validation logic can be simpler.

        Returns null if and only if the original expression is null.

        Overrides:
        performUnconditionalRewrites in class SqlValidatorImpl
        Parameters:
        node - expression to be rewritten
        underFrom - whether node appears directly under a FROM clause
        Returns:
        rewritten expression, or null if the original expression is null