NULL data is converted to '\ n' for numeric columns in the hive.?
I have created a hive table that has numeric columns like double and string columns. My file contains some NULL values ββfor numeric and string columns. When I try to load a file into this table, NULL values ββfor numeric columns are replaced with "\ n" in the file. I know it is a hive property that handles null values ββfor numeric columns, but I want to prevent this or is there any way I can change NULL to something else instead of '\ n'.
source to share
By default, values ββare NULL
written to data files because they are \N
also \N
interpreted in data files as NULL
when querying data.
This can be overridden usingTBLPROPERTIES('serialization.null.format'=...)
eg. TBLPROPERTIES('serialization.null.format'='')
means the following:
- Empty field in data files will be treated as NULL when querying the table
- When inserting rows into a table, NULL values ββwill be written to data files as empty fields
This property can be declared as part of the table creation
create table mytable (...)
tblproperties('serialization.null.format'='')
;
and can be changed later
alter table mytable set tblproperties('serialization.null.format'='')
;
source to share