Thanks Thejas.
I used the LAG function to compare the current value to previous one like this
select t.date, t.state from (select date, HA300BL_P, statechanged(LAG(state, 1) over (PARTITION BY weekofyear(date) ORDER BY date) as state_ from demo_bd where state is not null) t where t.state is not null;
This works fine.
However the performance are very very poor, I guess due to Lag function. So I don’t know if there is any way to optimize this type of query.
Thanks again.
↧
Reply To: Hive UDF function request problem
↧