How to specify a custom row for NULL values ​​in a Hive table stored as text?

When storing a Hive table in text format, for example, in 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 zero values ​​are represented as strings "\ n", also for numbers NaN are represented as strings "NaN".

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

I would like to use empty lines instead of "\ n" and 0 instead of "NaN". I know this substitution can be done with streaming, but is there any way to it using Hive instead of writing additional code?

Additional info: I use Hive 0.8, if that matters ...

+4
2

CREATE TABLE, EXISTS abc ( ) ROW FORMAT DELIMITED , '|' TBLPROPERTIES ( "serialization.null.format" = "")

+4

, . .

'\n', COALESCE:

INSERT OVERWRITE DIRECTORY 's3://bucket/result/' 
SELECT NULL, COALESCE(NULL,"")
FROM data_table;
+2

All Articles