Windowing in Hive

Windowing in Hive allows an analyst to create a window of data to operate aggregation and other analytical functions, such as LEAD and LAG.

The windowing specification in HiveQL comprises:

  • Partition
  • Order by
  • Window frame
  • Source name for window definition

Let's look into each of these specifications in detail:

  • Partition specification: It includes a column reference from the table. It could not be any aggregation or other window specification.
  • Order specification: It comprises a combination of one or more columns. The ordering could be ASC or DESC, which by default is ASC.

    Handling NULLs: There is no support for Nulls first or last specification. In Hive, Nulls are returned first.

  • Window frame: A frame has a start boundary and an optional ...

Get Apache Hive Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.