0
votes

Sqoop export to oracle fails with the below exception

Caused by: java.lang.RuntimeException: Can't parse input data: '\N'

I have null columns in HDFS.

Below is the command i used.

 sqoop export --connect jdbc:oracle:thin:@XXXXXXXXXXXXX \
             --username XX \
             --password XXXXX \
             --table XXXXXXXXXXXXXXXXXX\
             --export-dir '/datalake/qa/etl/XXXXXXX/XXXXXXXXXXXX' --input-fields-terminated-by ','  --input-null-string '\\N' --input-null-non-string '\\N'

and I tried with --input-null-string "\\\\N" --input-null-non-string "\\\\N" still no luck.

1

1 Answers

0
votes

The issue Is caused by the NUL character in the text.

for oracle database we dont need to mention --input-null-string for Null values which i tried in different ways thinking this is the cause for issue.

I checked the log files of the map task that was failed and found the NULL character in the string which is causing the issue.

I resolved the issue by using regexp_replace before exporting to HDFS directory using hive query regexp_replace(regexp_replace(rtrim(A.chat_agent_text),',','.'),'\0','.')

The issue is resolved now and sqoop export is successful

Observation: Can't parse input data: '\N' not always related to Null values of a column