Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-4172

SqlValidatorImpl.validateGroupClause should expand identifiers before resolving them against the catalog

    XMLWordPrintableJSON

Details

    Description

      I am attempt to support a Linq style syntax where you can 'dot' into a complex element.  In order to do this I am attempt to use SqlValidatorImpl.expand and related functions to rewrite the columnar identifiers before they are validated.

      SqlValidatorImpl.validateGroupClause calls SqlValidatorImpl.inferUnknownTypes which attempts to resolve the identifiers against the catalog.  Every where else that I am aware of first expands the identifier if configured to before resolving.

      SqlValidatorImpl.validateGroupClause immediately after calling inferUnknownTypes expands the identifiers.

      org.apache.calcite.sql.validate.SqlValidatorImpl.newValidationError(SqlValidatorImpl.java:4470) at org.apache.calcite.sql.validate.SqlValidatorImpl.newValidationError(SqlValidatorImpl.java:4470) at org.apache.calcite.sql.validate.DelegatingScope.fullyQualify(DelegatingScope.java:364) at org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:5220) at org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:5183) at org.apache.calcite.sql.SqlIdentifier.accept(SqlIdentifier.java:344) at org.apache.calcite.sql.validate.SqlValidatorImpl.deriveTypeImpl(SqlValidatorImpl.java:1602) at org.apache.calcite.sql.validate.SqlValidatorImpl.deriveType(SqlValidatorImpl.java:1587) at org.apache.calcite.sql.type.InferTypes$1.inferOperandTypes(InferTypes.java:52) at org.apache.calcite.sql.validate.SqlValidatorImpl.inferUnknownTypes(SqlValidatorImpl.java:1773) at org.apache.calcite.sql.validate.SqlValidatorImpl.inferUnknownTypes(SqlValidatorImpl.java:1738) at org.apache.calcite.sql.validate.SqlValidatorImpl.validateGroupClause(SqlValidatorImpl.java:3576) at org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelect(SqlValidatorImpl.java:3201) at org.apache.calcite.sql.validate.SelectNamespace.validateImpl(SelectNamespace.java:60) at org.apache.calcite.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:84) at org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:943) at org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:924) at org.apache.calcite.sql.SqlSelect.validate(SqlSelect.java:226)

       

      Attachments

        Issue Links

          Activity

            People

              danny0405 Danny Chen
              jamesstarr James Starr
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 20m
                  1h 20m