You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Aleksey Plekhanov (Jira)" <ji...@apache.org> on 2021/11/25 05:52:00 UTC
[jira] [Updated] (IGNITE-15984) Calcite engine. Query plan can't be planned if correlated variable used in both filter and project
[ https://issues.apache.org/jira/browse/IGNITE-15984?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Aleksey Plekhanov updated IGNITE-15984:
---------------------------------------
Description:
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.
was:
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.
> 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)