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

George Fraser commented on CALCITE-1518:
----------------------------------------

I believe the problem is here: 
https://github.com/apache/calcite/blob/5be0f0b046e36ea2ca3c052626599534dd8b0f71/core/src/main/java/org/apache/calcite/sql/SqlIdentifier.java#L369

`qualified.namespace.resolve().getMonotonicity(Util.last(fqId.names))` seems 
wrong when fqId is a multi-part identifier, and the scope returned by 
`qualified.namespace.resolve()` is the scope of the SELECT query.

I originally encountered this bug using TABLE(...) macros but it was simpler to 
reproduce using a literal.

> Converting SELECT table.nested.field FROM (...) to RelNode throws 
> ArrayIndexOutOfBoundsException
> ------------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-1518
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1518
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.10.0
>            Reporter: George Fraser
>            Assignee: Julian Hyde
>
> See 
> https://github.com/georgewfraser/calcite/commit/0c13c1b45f085018ca6992df6b66ee62d4f873cb
>  for test case SqlToRelConverterTest#testSelectNestedFromSubquery



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to