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

Sub-query in ON clause is not correctly expanded by SqlToRelConverter

    XMLWordPrintableJSON

Details

    Description

      SqlToRelConverter does not correctly expand a sub-query in an ON clause. Aggregation is dropped during decorrelation.

      SELECT "employee"."department_id", "employee"."salary"
      FROM "department"
      LEFT JOIN "employee" ON "employee"."salary" = (
        SELECT max("employee"."salary")
        FROM "employee"
        WHERE  "employee"."department_id" = "department"."department_id"
      )
      
      LogicalProject(department_id=[$9], salary=[$13])
        LogicalJoin(condition=[=($13, $0)], joinType=[left])
          LogicalTableScan(table=[[foodmart, department]])
          LogicalTableScan(table=[[foodmart, employee]])

      This may be related to CALCITE-4206.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jamesstarr James Starr
              Votes:
              0 Vote for this issue
              Watchers:
              6 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 - 2h 40m
                  2h 40m