serialization.null.format for Hive ORC table

James Isaac picture James Isaac · Aug 10, 2016 · Viewed 6.9k times · Source

I have a Hive table where the data is stored as ORC. Now, when I run a select * query on this table I see that the empty string columns are shown as NULL in the query result. I would like the empty string columns to be shown as empty strings in the hive query result as well.

I tried both of these, but it still shows the NULLs:

ALTER TABLE temp_table set SERDEPROPERTIES ('serialization.null.format' = "");
ALTER TABLE temp_table set TBLPROPERTIES ('serialization.null.format' = "");

Also tried giving single quotes:

ALTER TABLE temp_table set SERDEPROPERTIES ('serialization.null.format' = '');
ALTER TABLE temp_table set TBLPROPERTIES ('serialization.null.format' = '');

Storage properties of the hive table:

# Storage Information        
SerDe Library:          org.apache.hadoop.hive.ql.io.orc.OrcSerde    
InputFormat:            org.apache.hadoop.hive.ql.io.orc.OrcInputFormat  
OutputFormat:           org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat     
Compressed:             No                       
Num Buckets:            -1                       
Bucket Columns:         []                       
Sort Columns:           []                       
Storage Desc Params:         
        serialization.format    1                   
        serialization.null.format

Is there any way around this?

Answer