All Products
Search
Document Center

E-MapReduce:FAQ about Sqoop

Last Updated:Mar 26, 2026

Why is the timestamp field 8 hours earlier after importing from ApsaraDB RDS to EMR?

To fix this, remove --direct from the import command. This switches Sqoop back to JDBC mode, which handles timezone conversion correctly.

Original command (causes the issue):

sqoop import \
--connect jdbc:mysql://rm-2ze****341.mysql.rds.aliyuncs.com:3306/s***o_sqoop_db \
--username s***o \
--password ****** \
--table test_table \
--target-dir /user/hadoop/output \
--delete-target-dir \
--direct \
--split-by id \
--fields-terminated-by '|' \
-m 1

The test_table table in ApsaraDB RDS contains a timestamp field.

image

After the import, the timestamp field is 8 hours earlier than the original value.

image

Fixed command (remove `--direct`):

sqoop import \
--connect jdbc:mysql://rm-2ze****341.mysql.rds.aliyuncs.com:3306/s***o_sqoop_db \
--username s***o \
--password ****** \
--table test_table \
--target-dir /user/hadoop/output \
--delete-target-dir \
--split-by id \
--fields-terminated-by '|' \
-m 1

The timestamp field now shows the correct value.

image