Skip to main content
BIDEV3421
Bronze ⭐️⭐️⭐️
March 3, 2022
Question

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

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

araujo
Platinum ⭐️⭐️⭐️
Platinum ⭐️⭐️⭐️
March 3, 2022

@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

 

 

 

Translate
-- 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.