Aleksey Plekhanov created CALCITE-4923:
------------------------------------------

             Summary: 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


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.1#820001)

Reply via email to