Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-9132 CBO: Calcite Operator To Hive Operator (Calcite Return Path)
  3. HIVE-10416

CBO (Calcite Return Path): Fix return columns if Sort operator is on top of plan returned by Calcite

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.2.0
    • CBO
    • None

    Description

      When return path is on, if the plan's top operator is a Sort, we need to produce a SelectOp that will output exactly the columns needed by the FS.

      The following query reproduces the problem:

      select cbo_t3.c_int, c, count(*)
      from (select key as a, c_int+1 as b, sum(c_int) as c from cbo_t1
      where (cbo_t1.c_int + 1 >= 0) and (cbo_t1.c_int > 0 or cbo_t1.c_float >= 0)
      group by c_float, cbo_t1.c_int, key order by a) cbo_t1
      join (select key as p, c_int+1 as q, sum(c_int) as r from cbo_t2
      where (cbo_t2.c_int + 1 >= 0) and (cbo_t2.c_int > 0 or cbo_t2.c_float >= 0)
      group by c_float, cbo_t2.c_int, key order by q/10 desc, r asc) cbo_t2 on cbo_t1.a=p
      join cbo_t3 on cbo_t1.a=key
      where (b + cbo_t2.q >= 0) and (b > 0 or c_int >= 0)
      group by cbo_t3.c_int, c order by cbo_t3.c_int+c desc, c;
      

      Attachments

        1. HIVE-10416.patch
          46 kB
          jcamachorodriguez
        2. HIVE-10416.04.patch
          26 kB
          jcamachorodriguez
        3. HIVE-10416.03.patch
          26 kB
          jcamachorodriguez
        4. HIVE-10416.02.patch
          26 kB
          jcamachorodriguez
        5. HIVE-10416.01.patch
          30 kB
          jcamachorodriguez

        Activity

          People

            jcamacho Jesús Camacho Rodríguez
            jcamacho Jesús Camacho Rodríguez
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: