lundi 29 juin 2020

Getting NULL Value in ifnull() instead of set value

I'm trying to do the majority of my work in SparkSQL so I'm trying to figure out a solution using just sparksql.

Goal I'm trying to achieve is: When Src_Column2 = 'Hello' then load Target_Column as Src_Column1 else set Target_column = 0.00

So I tried but it loads the column as NULL is the condition isn't met:

(SELECT FIRST(IFNULL(Src_Column1, '0.00'))
FROM dfLookup Src_Table_1
WHERE     Src_Column2 = 'Hello')
AS Target_Column

Any help would be greatly appreciated.

Aucun commentaire:

Enregistrer un commentaire