Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-3977

RelDecorrelator does not resolve correlation variable with field accesses

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.22.0
    • None
    • core
    • None

    Description

      The RelCorrelator seems to have problems with some plans that contain a field access (probably a RexFieldAccess, but I haven't looked further into it). In this ticket there's a filter on $cor0.birthPlace.city.

      Here the complete plan:

      before decorrelate
      LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{}])
        LogicalTableScan(table=[[bookstore, authors]])
        LogicalFilter(condition=[=('Munich', $cor0.birthPlace.city)])
          LogicalTableScan(table=[[bookstore, authors]])
      
      after decorrelate
      LogicalJoin(condition=[=($2, $8)], joinType=[left])
        LogicalTableScan(table=[[bookstore, authors]])
        LogicalJoin(condition=[true], joinType=[inner])
          LogicalFilter(condition=[=('Munich', $cor0.birthPlace.city)])
            LogicalTableScan(table=[[bookstore, authors]])
          LogicalAggregate(group=[{0}])
            LogicalProject(birthPlace=[$2])
              LogicalTableScan(table=[[bookstore, authors]])
      

      There seem to be two problems:

      • The LogicalCorrelate has been removed, but the $cor0.birthPlace.city is still in the filter condition.
      • The inner join does not seem to be necessary. If it is, could somebody explain, why?

      Attachments

        1. Calcite3977.java
          3 kB
          Thomas Rebele

        Issue Links

          Activity

            People

              Unassigned Unassigned
              thomas.rebele Thomas Rebele
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated: