Search code examples
mysqlnullhivesqoop

Mysql Null values sqoop import to hive


I have a table in mysql with some columns have null values. I want to sqoop import the table to hive. When I do sqoop import I am getting all null values in the columns that have null in the mysql table.

What I want is if the column value in mysql is null then the same column value in Hive to be empty not null

How can we achieve this?


Solution

  • You can easily achieve this using:

    • --null-string <null-string> The string to be written for a null value for string columns
    • --null-non-string <null-string> The string to be written for a null value for non-string columns

    Add these tag to replace null values of MySQL to any value you want.

    For example, for replacing null with empty values, add these tags in your command

     --null-string '' --null-non-string ''