Recently I discovered an issue in Sqoop that when importing data into Hive table, whose location is in an encrypted HDFS zone, it will fail with “can’t be moved into an encryption zone” error:


sqoop import --connect <postgres_url> --username <username> --password <password> \
--table sourceTable --split-by id --hive-import --hive-database staging \
--hive-table hiveTable --as-parquetfile


2017-05-24 13:38:51,539 INFO [Thread-84] 
Setting job diagnostics to Job commit failed: Could not move contents of hdfs://nameservice1/tmp/staging/.
temp/job_1495453174050_1035/mr/job_1495453174050_1035 to 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(
        at java.util.concurrent.ThreadPoolExecutor$
Caused by: org.apache.hadoop.ipc.RemoteException( 
can't be moved into an encryption zone.
        at org.apache.hadoop.hdfs.server.namenode.EncryptionZoneManager.checkMoveValidity(
        at org.apache.hadoop.hdfs.server.namenode.FSDirectory.unprotectedRenameTo(
        at org.apache.hadoop.hdfs.server.namenode.FSDirectory.renameTo(
        at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.renameToInternal(
        at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.renameToInt(
        at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.renameTo(

This is caused by a known Sqoop bug: SQOOP-2943. This happens because Sqoop uses Kite SDK to generate Parquet file, and Kite SDK uses /tmp directory to generate the parquet file on the fly. And because /tmp directory is not encrypted and hive warehouse directory is encrypted, the final move command to move the parquet file from /tmp to hive warehouse will fail due to the encryption. The import only fails with parquet format, text file format works as expected.

Currently SQOOP-2943 is not fixed and there is no direct workaround.

For the time being, the workaround is to:

  1. Import data as text file format into Hive temporary table, and then use Hive query to copy data into destination parquet table. OR
  2. Import data as parquet file into temporary directory outside of Hive warehouse, and then again use Hive to copy data into destination parquet table

Leave a Reply

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