0

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.

TheGameiswar
  • 27,855
  • 8
  • 56
  • 94
user11069271
  • 109
  • 2
  • 6

1 Answers1

1

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)
e_i_pi
  • 4,590
  • 4
  • 27
  • 45
pb7708
  • 31
  • 2