Reputation: 119
I am trying to rewrite last value(col1 ignore nulls )
analytical function in hive from RDMS.
I used select last_value(col1,TRUE)
But I am getting null as output when used for above query. Can someone please suggest is there any other way to ignore nulls in analytic function in hive.
Upvotes: 0
Views: 2451
Reputation: 31
The default comparison method of the OVER()
function is to compare the current row with all previous rows. You need to add a sentence after the order by
statement: rows between unbounded preceding and unbounded following
:
last_value(col1,TRUE) over (partition by col1 order by col2 rows between unbounded preceding and unbounded following)
Upvotes: 1