Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-9412

Window clause ROW BETWEEN for PRECEDING does not work

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • 0.13.1, 0.14.0
    • 2.0.0
    • Parser
    • None
    • CDH 5.3 or HDP 2.2

    Description

      When window clause with ROWS is used between two proper PRECEDING boundaries, Hive reports syntax errors as following examples.

      --For example 1
      SELECT name, dept_num, salary,
      MAX(salary) OVER (PARTITION BY dept_num ORDER BY
      name ROWS BETWEEN 2 PRECEDING AND 1 PRECEDING) win4_alter
      FROM employee_contract;

      Error: Error while compiling statement: FAILED: SemanticException Failed to breakup Windowing invocations into Groups. At least 1 group must only depend on input columns. Also check for circular dependencies.
      Underlying error: Window range invalid, start boundary is greater than end boundary: window(start=range(2 PRECEDING), end=range(1 PRECEDING)) (state=42000,code=40000)

      --For example 2
      SELECT name, dept_num, salary,
      MAX(salary) OVER (PARTITION BY dept_num ORDER BY
      name ROWS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING) win1
      FROM employee_contract;

      Error: Error while compiling statement: FAILED: SemanticException End of a WindowFrame cannot be UNBOUNDED PRECEDING (state=42000,code=40000)

      Attachments

        1. HIVE-9412.1.patch.txt
          49 kB
          Navis Ryu
        2. HIVE-9412.2.patch.txt
          49 kB
          Navis Ryu
        3. HIVE-9412.3.patch.txt
          49 kB
          Navis Ryu

        Issue Links

          Activity

            People

              navis Navis Ryu
              willddy Will Du
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: