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

Benchao Li edited comment on CALCITE-5127 at 6/15/22 12:56 AM:
---------------------------------------------------------------

I would like to share some observations for our further discussions:
1. {{Join}} has correlation variables since the very initial commit of Calcite. 
At that time, it's the only way to do correlation.
2. {{Correlate}} and {{LogicalCorrelate}} was introduced by CALCITE-483, since 
then we have a dedicated {{RelNode}} to do correlate.
3. correlated {{LogicalFilter}} was introduced by CALCITE-816, and we do not 
put correlation variables into {{{}Filter{}}}. (I assume that we do not want to 
leak correlation variables to physical nodes. And this is reason why 
[https://github.com/apache/calcite/pull/2623] and 
[https://github.com/apache/calcite/pull/2813] implemented it in 
{{LogicalProject}} instead of {{Project}} in the first time.)
4. in optimizing process (VocanoPlanner), there is a piece of code 
([https://github.com/apache/calcite/blob/d1cf4a38b71b514b1d208b5ffa3220b92693464f/core/src/main/java/org/apache/calcite/plan/volcano/RelSubset.java#L374-L383])
 which tries to enforce correlation variables propagation checking, however 
it's disabled by default since the first day of Calcite.


was (Author: libenchao):
I would like to share some observations for our further discussions:
1. {{Join}} has correlation variables since the very initial commit of Calcite. 
At that time, it's the only way to do correlation.
2. {{Correlate}} and {{LogicalCorrelate}} was introduced by CALCITE-483, since 
then we have a dedicated {{RelNode}} to do correlate. 3. correlated 
{{LogicalFilter}} was introduced by CALCITE-816, and we do not put correlation 
variables into {{Filter}}. (I assume that we do not want to leak correlation 
variables to physical nodes. And this is reason why 
[https://github.com/apache/calcite/pull/2623] and 
[https://github.com/apache/calcite/pull/2813] implemented it in 
{{LogicalProject}} instead of {{Project}} in the first time.)
4. in optimizing process (VocanoPlanner), there is a piece of code 
(https://github.com/apache/calcite/blob/d1cf4a38b71b514b1d208b5ffa3220b92693464f/core/src/main/java/org/apache/calcite/plan/volcano/RelSubset.java#L374-L383)
 which tries to enforce correlation variables propagation checking, however 
it's disabled by default since the first day of Calcite.

> 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