Data exchange with [EX|IM]PORT
When working on data migration or release deployment, we may need to move data between different environments or clusters. In HQL, EXPORT
and IMPORT
statements are available to move data between HDFS in different environments or clusters. The EXPORT
statement exports both data and metadata from a table or partition. Metadata is exported in a file called _metadata
. Data is exported in a subdirectory called data, as follows:
> EXPORT TABLE employee TO '/tmp/output5'; No rows affected (0.19 seconds) > dfs -ls -R /tmp/output5/; +--------------------------------+ | DFS Output | +--------------------------------+ | ... /tmp/output5/_metadata | | ... /tmp/output5/data | | ... /tmp/output5/data/000000_0 | +--------------------------------+ 3 rows selected (0.014 seconds)
Note
For EXPORT
, the database name can be used before the table name without any syntax error, but the database is useless and ignored by the IMPORT
statement.
Once...