Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-15984

Calcite engine. Query plan can't be planned if correlated variable used in both filter and project

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 2.15
    • None

    Description

      For example, query:

      CREATE TABLE test(i INT)
      SELECT (SELECT t0.i FROM test t1 WHERE t1.i = t0.i) FROM test t0
      

      Fails, but if we make project uncorrelated:

      SELECT (SELECT t1.i FROM test t1 WHERE t1.i = t0.i) FROM test t0
      

      Or remove correlated filter:

      SELECT (SELECT t0.i FROM test t1) FROM test t0
      

      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.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              alex_pl Aleksey Plekhanov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: