Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Support Questions

Find answers, ask questions, and share your expertise
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!

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.