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

Calcite. Correlated expressions with subquery can be planned.

    XMLWordPrintableJSON

Details

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

    Description

      statement ok
      CREATE TABLE integers(i INTEGER)
      
      statement ok
      INSERT INTO integers VALUES (1), (2), (3), (NULL)
      
      # union with correlated expression
      query II
      SELECT i, (SELECT i FROM integers WHERE i=i1.i UNION SELECT i FROM integers WHERE i=i1.i) AS j FROM integers i1 ORDER BY i NULLS FIRST;
      ----
      NULL	NULL
      1	1
      2	2
      3	3
      
      # join on two subqueries that both have a correlated expression in them
      query II
      SELECT i, (SELECT s1.i FROM (SELECT i FROM integers WHERE i=i1.i) s1 INNER JOIN (SELECT i FROM integers WHERE i=4-i1.i) s2 ON s1.i>s2.i) AS j FROM integers i1 ORDER BY i;
      ----
      NULL	NULL
      1	NULL
      2	NULL
      3	3
      
      /subquery/scalar/test_complex_correlated_subquery.test[_ignore]
      
      org.apache.ignite.internal.processors.query.calcite.exec.ExecutionServiceImplc{1}] Unexpected error at query optimizer.
      org.apache.calcite.plan.RelOptPlanner$CannotPlanException: There are not enough rules to produce a node with desired properties: convention=IGNITE, sort=[0 ASC-nulls-first], distr=single, rewindability=one-way, correlation=uncorrelated.
      Missing conversions are LogicalFilter[convention: NONE -> IGNITE, distr: any -> random], IgniteUnionAll[sort: [] -> [0]], LogicalFilter[convention: NONE -> IGNITE, sort: [] -> [0], distr: any -> random, rewindability: one-way -> rewindable], LogicalFilter[convention: NONE -> IGNITE, distr: any -> single], LogicalFilter[convention: NONE -> IGNITE, distr: any -> single, rewindability: one-way -> rewindable]
      There are 5 empty subsets:
      

      Attachments

        Issue Links

          Activity

            People

              alex_pl Aleksey Plekhanov
              zstan Evgeny Stanilovsky
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: