Taras Ledkov created IGNITE-14973:
-------------------------------------

             Summary: Calcite engine. IgniteLimit is pushed down under Exchange 
invalid
                 Key: IGNITE-14973
                 URL: https://issues.apache.org/jira/browse/IGNITE-14973
             Project: Ignite
          Issue Type: Bug
          Components: sql
            Reporter: Taras Ledkov


In complex cases {{IgniteLimit}} is pushed down under Exchange node.

*Steps to reproduce:*
{code}
CREATE TABLE test (a VARCHAR);
INSERT INTO test VALUES ('aaa'), ('bbb'), ('ccc');
CREATE TABLE test2 (a VARCHAR, b VARCHAR);
INSERT INTO test2 VALUES ('blabla', 'b'), ('blabla2', 'c'), ('blabla3', 'd');

SELECT NULLIF(NULLIF ((SELECT a FROM test ORDER BY a LIMIT 1 offset 1), a), b) 
FROM test2;
{code}

*Plan:*
{code}
IgniteProject(EXPR$0=[CASE(=(CASE(=($4, $2), null:VARCHAR CHARACTER SET 
"UTF-8", $5), $3), null:VARCHAR CHARACTER SET "UTF-8", CASE(=($4, $2), 
null:VARCHAR CHARACTER SET "UTF-8", $6))])
  IgniteNestedLoopJoin(condition=[true], joinType=[left])
    IgniteNestedLoopJoin(condition=[true], joinType=[left])
      IgniteNestedLoopJoin(condition=[true], joinType=[left])
        IgniteExchange(distribution=[single])
          IgniteIndexScan(table=[[PUBLIC, TEST2]], index=[_key_PK])
        IgniteExchange(distribution=[single])
          IgniteLimit(offset=[1], fetch=[1])
            IgniteIndexScan(table=[[PUBLIC, TEST]], index=[_key_PK], 
requiredColumns=[{2}])
      IgniteExchange(distribution=[single])
        IgniteLimit(offset=[1], fetch=[1])
          IgniteIndexScan(table=[[PUBLIC, TEST]], index=[_key_PK], 
requiredColumns=[{2}])
    IgniteExchange(distribution=[single])
      IgniteLimit(offset=[1], fetch=[1])
        IgniteIndexScan(table=[[PUBLIC, TEST]], index=[_key_PK], 
requiredColumns=[{2}])
{code}




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to