Support Questions

Find answers, ask questions, and share your expertise

Display blank space for a column as NULL in the HIVE table data

avatar
New Contributor

I am trying to display a column in HIVE as 'NULL' whenever the source data has a blank space. I tried using the SET TBLPROPERTIES ('serialization.null.format'='\\N') and SET TBLPROPERTIES ('serialization.null.format'='') which did not work. Does anyone know how to resolve this? 

1 REPLY 1

avatar
Super Guru

@BIDEV3421 

 

This property is for the opposite of what you want. The value of this property is what hive shows when the source day has a null value.

 

I don't think there's a property to do what you want, but you can use an expression like the following in your select:

 

case when mycol = ' ' then NULL else mycol end

 

Cheers

Andre

 

 

 

--
Was your question answered? Please take some time to click on "Accept as Solution" below this post.
If you find a reply useful, say thanks by clicking on the thumbs up button.