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

Drill window functions return wrong results

    XMLWordPrintableJSON

Details

    Description

      Executing the following window function with the requirement to see how a given employee salary would compare to the avg(salary) in his/her position.
      Query executes fine however returns wrong results(expect the avg(salary) to stay same for a given window (i.e position id)

      0: jdbc:drill:zk=local> SELECT employee_id,position_id, salary, avg(salary) OVER (PARTITION BY position_id order by position_id) FROM cp.`employee.json` order by employee_id;
      --------------------------------------------+

      employee_id position_id salary EXPR$3

      --------------------------------------------+

      1 1 80000.0 80000.0
      2 2 40000.0 37500.0
      4 2 40000.0 38333.333333333336
      5 2 35000.0 35000.0
      6 3 25000.0 25000.0
      7 4 15000.0 15000.0
      8 11 10000.0 14333.333333333334
      9 11 17000.0 17000.0

      Attachments

        Issue Links

          Activity

            People

              adeneche Abdel Hakim Deneche
              Neeraja Neeraja
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: