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

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

For this PR let's focus on {{Project}} operator; we can discuss changes to 
\{{Filter}} separately and when it becomes necessary. 

I agree that we should update the javadoc of \{{RelNode#getVariablesSet}}; I 
think I made a similar comment to the previous PR by Konstantin.

Rules should not drop correlation variables from Project silently; if we can 
find an easy way to assert this somehow in the planner would be great but let's 
treat this better in a follow-up JIRA. It might not be such of an issue after 
all since as we discussed previously after \{{SubQueryRemoveRule}} we should 
not have correlations in \{{Project}}.

In general, it is common practice to run \{{SubQueryRemoveRule}} at some 
preprocessing step since rules in general do not currently apply inside a 
subquery. If somebody works with a plan where subqueries are not expanded they 
probably miss many interesting transformations.

> 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.32.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