[
https://issues.apache.org/jira/browse/IGNITE-15984?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17454163#comment-17454163
]
Konstantin Orlov commented on IGNITE-15984:
-------------------------------------------
Looks like this ticket and IGNITE-16040 are about the same issue
> Calcite engine. Query plan can't be planned if correlated variable used in
> both filter and project
> --------------------------------------------------------------------------------------------------
>
> Key: IGNITE-15984
> URL: https://issues.apache.org/jira/browse/IGNITE-15984
> Project: Ignite
> Issue Type: Bug
> Reporter: Aleksey Plekhanov
> Priority: Major
> Labels: calcite2-required, calcite3-required
>
> For example, query:
> {noformat}
> CREATE TABLE test(i INT)
> SELECT (SELECT t0.i FROM test t1 WHERE t1.i = t0.i) FROM test t0
> {noformat}
> Fails, but if we make project uncorrelated:
> {noformat}
> SELECT (SELECT t1.i FROM test t1 WHERE t1.i = t0.i) FROM test t0
> {noformat}
> Or remove correlated filter:
> {noformat}
> SELECT (SELECT t0.i FROM test t1) FROM test t0
> {noformat}
> Query executes successfully.
> Reson: for filter and for project new correlates are created each time, but
> {{SubQueryRemoveRule}} expects only one correlate to build
> {{LogicalCorrelate}} relational operator. If the count of correlates is not
> equal to one - a regular join is created and the query can't be planned.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)