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

Stamatis Zampetakis commented on CALCITE-5127:
----------------------------------------------

Thanks for updating the PR [~libenchao] . 

After {{SubQueryRemoveRule}} there shouldn't be any sub-queries in the plan. 
For this to happen we will most likely need to introduce {{Correlate}} 
expressions. I think it is reasonable to say that there will be no correlations 
in Project, Filter, and Join.

After {{RelDecorrelator}} there shouldn't be any correlations in the plan so it 
is quite different than the {{SubQueryRemoveRule}}.

Nevertheless we cannot enforce downstream users of Calcite to use 
{{SubQueryRemoveRule}} or {{RelDecorrelator}} so rules should be aware of 
correlation variables.

I will try to think what is the best course of action to move this PR forward 
and add further comments.

In the meantime I think we shouldn't block the 1.31.0 release for this ticket. 
It seems unlikely to merge this in the next 24 hours thus I would suggest to 
move the ticket to 1.32.0. If this is really blocking for downstream projects 
then we could cut 1.32.0 right after merging this to main. What do you think 
[~libenchao] [~dmsysolyatin]?



> Error when executing query with subquery in select list that uses outer 
> column of array type
> --------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-5127
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5127
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Dmitry Sysolyatin
>            Assignee: Benchao Li
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.31.0
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> The following queries fail:
> {code}
> SELECT ARRAY(SELECT s.x) FROM (SELECT ARRAY[1,2,3] as x) s;
> SELECT ARRAY(SELECT * FROM UNNEST(s.x) y) FROM (SELECT ARRAY[1,2,3] as x) s;
> SELECT (SELECT CARDINALITY(s.x) LIMIT 1) FROM (SELECT ARRAY[1,2,3] as x) s;   
>  
> {code}
> With exception:
> {code}
> Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to 
> java.util.List
> {code}
> You can find test cases for this task in 
> https://github.com/apache/calcite/commit/27e68ded2c3bea7d7af73dd1dc156e46fb3591a8



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to