How to ask Sqoop to empty NULL valued fields when importing into Hive

How to ask Sqoop to empty NULL valued fields when importing into Hive

Data imported from Postgres into Hive has lots of fields with “null” as the value, including fields with BIGINT data type. When Impala tries to read the table with such data, it produces lots of warning message:

WARNINGS: Backend 2:Error converting column: 6 TO BIGINT (Data is: null)

To force Sqoop to leave NULL value blank during import, put the following options in the Sqoop command line:

–null-string The string to be written for a null value for string columns
–null-non-string The string to be written for a null value for non-string columns

In this case should be –null-non-string because the field is a BIGINT data type.

Loading

Leave a Reply

Your email address will not be published. Required fields are marked *

My new Snowflake Blog is now live. I will not be updating this blog anymore but will continue with new contents in the Snowflake world!