How to specify custom string for NULL values in Hive table stored as text?

Viewed 10608

When storing Hive table in text format, for example this table:

CREATE EXTERNAL TABLE clustered_item_info
  (
    country_id              int,
    item_id                 string,
    productgroup            int,
    category                string
  )
  PARTITIONED BY (cluster_id int)
  ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'
  LOCATION '${hivevar:table_location}';

Fields with null values are represented as '\N' strings, also for numbers NaNs are represented as 'NaN' strings.

Does Hive provide a way to specify custom string to represent these special values?

I would like to use empty strings instead of '\N' and 0 instead of 'NaN' - I know this substitution can be done with streaming, but is there any way to it cleanly using Hive instead of writing extra code?

Other info: I'm using Hive 0.8 if that matters...

2 Answers
Related