[ 
https://issues.apache.org/jira/browse/CALCITE-4172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17177288#comment-17177288
 ] 

James Starr commented on CALCITE-4172:
--------------------------------------

[~julianhyde], what particular formatting do want be clean up?  Would you like 
me to move the test into another class?  Any preference on which?
  
I believe that expand was called before other call to the catalog was initial 
at some point in time, but not enforce.  And then derived types was added or 
expanded, and not much thought was put into where exactly it was called, and 
this is simply fixing the over site.  InferTypes is calling the catalog to get 
the type of the field so it can infer it....

To clarify, I want to do this because I want a relatively clean api to rewrite 
column references.

> SqlValidatorImpl.validateGroupClause should expand identifiers before 
> resolving them against the catalog
> --------------------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-4172
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4172
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: James Starr
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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.
> {code:java}
> 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){code}
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to