[
https://issues.apache.org/jira/browse/CALCITE-5127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17603256#comment-17603256
]
Stamatis Zampetakis commented on CALCITE-5127:
----------------------------------------------
[~julianhyde] I have been following this case for a little while so let me try
to summarize briefly the situation (from my perspective).
The problem described in this Jira is really a bug:
{_}SqlToRelConverter/RelBuilder wrongly removes used fields when merging
projections{_}. If we prevent the merge of the projection then all queries
reported here run fine.
Allowing project to set correlating variables is in some sense already possible
without merging the PR. The difference is that the current PR makes it explicit
by adding a new attribute in the {{Project}} class. This change though is not
really needed to solve the bug reported here.
I am pushing back a bit regarding the changes that introduce the new attribute
in {{Project}} since they lead to changes everywhere (RelBuilder APIs, RelNode
APIs, rules, adapters, downstream projects, etc.) and so far I don't see an
obvious advantage in doing this now.
> 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.33.0
>
> Time Spent: 1h 20m
> 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.10#820010)