SQOOP : mapred.FileAlreadyExistsException : Output directory

Sometimes when you import data from RDBMS to Hadoop via Sqoop you will see this error.

org.apache.hadoop.mapred.FileAlreadyExistsException: Output directory

hdfs://hadoopcluster/user/username/importtable  already exists

Solution:

$ hdfs dfs -rm -r -skipTrash  hdfs://hadoopcluster/user/username/importtable

Reason:

When Sqoop is used for Importing data, sqoop creates a temporary file under  home directory and later deletes those files. Sometimes due to some issue, sqoop will exit without deleting the folder. In that case it generates this error. Solution is to manually delete the folder using  hdfs dfs -rm -r command.

 

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.