Reputation: 581
I have the following conditional statement i am trying to convert into hive
if [my_time] > [your_time] then [my_time]
elseif isNull ([your_time])
then [my_time]
else null()
endif
Also my_time and your_time are in timestamp formats. I have tried the following below in hive but it doesn't seem to be correct as some expected results are missing
case when (my_time > your_time) then my_time
when (your_time = Null) then my_time
end as overall_time
How can i fix my logic in the second statement above.
Upvotes: 0
Views: 3503
Reputation: 31656
NULL
can't be compared with an equal to (=)
Use IS NULL
instead of = NULL
.
Your logic is equivalent to
case
when your_time IS NULL
OR my_time > your_time
then my_time
end as overall_time
Upvotes: 2