Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Hive set Null value to Empty string

avatar
Contributor

Hi All,

I have Hive table with ORC format, an i have some records stored as Null in the table, is there any configuration in hive to Set Null as Empty string while Querying the data ?

Cheers,

MJ

3 REPLIES 3

avatar
Contributor

I don't think there is any such configuration. You can use CASE statement to achieve this e.g.

SELECT CASE WHEN col is NULL THEN '' ELSE col END from table;

avatar
Contributor

Hi @vgarg,

Tanx for your reply, i dont think so case statement would helpful for me, coz i need to make this change at globally across all my systems.

Cheers,

MJ

avatar
Contributor

Hi @vgarg,

Since 0.11 hive has a NVL function nvl(T value, T default_value)

which says Returns default value if value is null else returns value