Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-4539

Add support for Null Equality Joins

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      Tableau frequently generates queries similar to this:

      SELECT `t0`.`city` AS `city`,
        `t2`.`X_measure__B` AS `max_Calculation_DFIDBHHAIIECCJFDAG_ok`,
        `t0`.`state` AS `state`,
        `t0`.`sum_stars_ok` AS `sum_stars_ok`
      FROM (
        SELECT `business`.`city` AS `city`,
          `business`.`state` AS `state`,
          SUM(`business`.`stars`) AS `sum_stars_ok`
        FROM `mongo.academic`.`business` `business`
        GROUP BY `business`.`city`,
          `business`.`state`
      ) `t0`
        INNER JOIN (
        SELECT MAX(`t1`.`X_measure__A`) AS `X_measure__B`,
          `t1`.`city` AS `city`,
          `t1`.`state` AS `state`
        FROM (
          SELECT `business`.`city` AS `city`,
            `business`.`state` AS `state`,
            `business`.`business_id` AS `business_id`,
            SUM(`business`.`stars`) AS `X_measure__A`
          FROM `mongo.academic`.`business` `business`
          GROUP BY `business`.`city`,
            `business`.`state`,
            `business`.`business_id`
        ) `t1`
        GROUP BY `t1`.`city`,
          `t1`.`state`
      ) `t2` ON (((`t0`.`city` = `t2`.`city`) OR ((`t0`.`city` IS NULL) AND (`t2`.`city` IS NULL))) AND ((`t0`.`state` = `t2`.`state`) OR ((`t0`.`state` IS NULL) AND (`t2`.`state` IS NULL))))
      

      If you look at the join condition, you'll note that the join condition is an equality condition which also allows null=null. We should add a planning rewrite rule and execution join option to allow null equality so that we don't treat this as a cartesian join.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                RomanKulyk Roman Kulyk
                Reporter:
                jnadeau Jacques Nadeau
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated: