Konstantin Orlov created IGNITE-27555:
-----------------------------------------

             Summary: Sql. Wrong plan generated by decorrelator when 
correlation id is used in multiple operators
                 Key: IGNITE-27555
                 URL: https://issues.apache.org/jira/browse/IGNITE-27555
             Project: Ignite
          Issue Type: Bug
          Components: sql ai3
            Reporter: Konstantin Orlov


This problem was discovered while implementing IGNITE-22092. To reproduce it 
may be needed to remove validation in 
{{org.apache.ignite.internal.sql.engine.prepare.PlannerHelper#tryDecorrelate}} 
(search for usages of {{CorrelationUsedOnlyInSingleRelValidator}}).

Take a look at this test cases:

{code:java}
CREATE TABLE integers(i INTEGER)
INSERT INTO integers VALUES (1), (2), (3), (NULL)

SELECT i, (SELECT COUNT(*) FROM integers i2 WHERE i2.i>i1.i GROUP BY i1.i) FROM 
integers i1 ORDER BY i;
----
1       2
2       1
3       NULL
NULL    NULL
{code}

If we disable aforementioned validation, then test will fail with {{Invalid 
results: [[1, 3], [2, 3], [3, 3], [null, 3]]}}.




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to