Section 12.141.Getting-First-value-and-Last-value-using-Windowing-functions in hive

In Hive, you can use windowing functions to get the first and last values of a column. The first_value() function returns the value of a column in the first row of the current row’s partition, and the last_value() function returns the value of a column in the last row of the current row’s partition.

To use first_value() and last_value() functions, you need to specify the ordering of the rows within the partition using the ORDER BY clause in the OVER clause.

Share this post