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

Julian Hyde commented on CALCITE-4923:
--------------------------------------

The pattern I see here is people making assumptions when making extensions. I'm 
not blaming anyone, and it appears that the people who made the extensions are 
the ones now getting bitten, so they have an incentive to fix the problem.

In hindsight, the extension would have been called out as a feature request, 
e.g. ability to define system columns, and have those system columns removed 
from the SELECT list.

In any case, it's often useful to contribute extra tests when you extend the 
logic. Those tests can serve as an early warning if someone changes in Calcite 
in ways that will break your extensions.

Let me be clear. If you have extended non-public APIs, and you get broken by 
future changes to Calcite, that is your problem, not Calcite's. And the Java 
keywords {{public}} or {{protected}} do not mean that an API is public.

> Expand "star" for NATURAL JOIN fails if some columns are filtered out by 
> addToSelectList
> ----------------------------------------------------------------------------------------
>
>                 Key: CALCITE-4923
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4923
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Aleksey Plekhanov
>            Priority: Major
>
> If all columns ("*") are requested and some table columns are filtered out by 
> overridden {{SqlValidatorImpl.addToSelectList()}} method (for example, some 
> system columns, which we don't want to show to user until it explicitly 
> requests it) query with NATURAL JOIN and JOIN with USING fail on 
> {{SqlValidatorImpl.expandStar()}} with error:
> {noformat}
> java.lang.ArrayIndexOutOfBoundsException: 7
>       at 
> com.google.common.collect.RegularImmutableList.get(RegularImmutableList.java:60)
>       at 
> org.apache.calcite.sql.validate.SqlValidatorImpl$Permute.permute(SqlValidatorImpl.java:7109)
>       at 
> org.apache.calcite.sql.validate.SqlValidatorImpl.expandStar(SqlValidatorImpl.java:664)
>       at 
> org.apache.calcite.sql.validate.SqlValidatorImpl.expandSelectItem(SqlValidatorImpl.java:426)
>       at 
> org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelectList(SqlValidatorImpl.java:4409)
>       at 
> org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelect(SqlValidatorImpl.java:3652)
> {noformat}
> Because {{Permute.permute()}} rely on columns count equality in 
> {{selectItems}} and JOIN row type.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to