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

Calcite engine. Not correlated condition is not pushed to table scan if there is also correlated condition in the filter

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 2.15
    • None
    • SQL Calcite: Added optimization: push not correlated filter part to the table scan
    • Release Notes Required

    Description

      Not correlated condition cannot be pushed to table scan if there is also correlated condition in the filter.

      For example, in this query:

      SELECT (SELECT id FROM tbl AS t2 WHERE t2.id < 50 AND t2.id = t1.id) FROM tbl AS t1 

      Condition t2.id < 50 can be pushed to table scan and condition t2.id = t1.id can be used as hash spool search row, but currently filter can't be splitted and plan uses table spool instead of hash spool and become very ineffective:

      IgniteProject(EXPR$0=[$1])
        IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], correlationVariables=[[$cor0]])
          IgniteExchange(distribution=[single])
            IgniteTableScan(table=[[PUBLIC, TBL]])
          IgniteColocatedHashAggregate(group=[{}], agg#0=[SINGLE_VALUE($0)])
            IgniteFilter(condition=[AND(<($0, 50), =($0, $cor0.ID))])
              IgniteTableSpool(readType=[LAZY], writeType=[EAGER])
                IgniteExchange(distribution=[single])
                  IgniteTableScan(table=[[PUBLIC, TBL]])

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m