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

sum() over (order by c) should default the windowing spec to RangeBoundarySpec

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Not A Problem
    • 2.1.0
    • None
    • PTF-Windowing
    • None

    Description

      Currently sum() over (partition by a) without order by is defaulted windowing to RangeBoundarySpec while sum() over (partition by a order by c) is defaulted to ValueBoundarySpec. It's not consistent and the user gets confused of the switch from "rows between" to "range between" by adding "order by c" clause.

      From the comment

        /*
         * - A Window Frame that has only the /start/boundary, then it is interpreted as:
               BETWEEN <start boundary> AND CURRENT ROW
         * - A Window Specification with an Order Specification and no Window
         *   Frame is interpreted as:
               ROW BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
         * - A Window Specification with no Order and no Window Frame is interpreted as:
               ROW BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING
         */
      

      We intended to set as "row between" (RangeBoundarySpec), not "range between" (ValueBoundarySpec).

      Attachments

        1. HIVE-15498.1.patch
          4 kB
          Aihua Xu
        2. HIVE-15498.2.patch
          68 kB
          Aihua Xu

        Activity

          People

            Unassigned Unassigned
            aihuaxu Aihua Xu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: