Reputation: 231
I created a hive table which has numeric columns such as double and string columns.My file contains some NULL values for both numeric and string columns. When I try to load a file into this table, NULL values for the numeric columns is replaced by '\N' in file.I know this is hive property that handle null values for numeric type columns but i want to prevent it or Is there any way that i can change NULL into something else instead of '\N'.
Upvotes: 10
Views: 10199
Reputation: 44941
By default NULL
values are written in the data files as \N
and \N
in the data files are being interpreted as NULL
when querying the data.
This can be overridden by using TBLPROPERTIES('serialization.null.format'=...)
E.g.
TBLPROPERTIES('serialization.null.format'='')
means the following:
This property can be declared as part of the table creation
create table mytable (...)
tblproperties('serialization.null.format'='')
;
and can be changed later on
alter table mytable set tblproperties('serialization.null.format'='')
;
Upvotes: 21