Monday, June 19, 2017

Hive-coalesce

coalesce
--------
it returns first non null value from a list of values
it returns null if all values are null.

cat  > data.txt
,1,,12345
rama,3,8790,
vidhatri,4,,
,,,,

syntax
------
select coalesce(col1,col2,.....);


hive> select coalesce(name,a,b,c) from coaldata;
OK
Mano
rama
vidhatri

No comments: