Running Hive import and export operations test
This section lists the steps for running Hive import and export operations test.
- On the local HDFS cluster, EXPORT local_db internal partitioned table to the remote HDFS
Transparency
cluster.
hive> EXPORT TABLE local_db.passwd_int_part TO 'hdfs://c16f1n03.gpfs.net:8020/user/hive/remote_db/passwd_int_part_export'; OK Time taken: 0.986 seconds
- On the local HDFS cluster, list the directory/file that was created on the remote HDFS
Transparency cluster using the EXPORT
operation.
hive> dfs -ls hdfs://c16f1n03.gpfs.net:8020/user/hive/remote_db/passwd_int_part_export; Found 2 items -rw-r--r-- 1 hdp-user1 root 2915 2018-03-19 21:43 hdfs://c16f1n03.gpfs.net:8020/user/hive/remote_db/passwd_int_part_export/_metadata drwxr-xr-x - hdp-user1 root 0 2018-03-19 21:43 hdfs://c16f1n03.gpfs.net:8020/user/hive/remote_db/passwd_int_part_export/group_id=2011-12-14
- On the local HDFS cluster, IMPORT table to create a table in the local_db from the EXPORT data
from the above step on the remote HDFS Transparency
cluster.
hive> IMPORT TABLE local_db.passwd_int_part_import FROM 'hdfs://c16f1n03.gpfs.net:8020/user/hive/remote_db/passwd_int_part_export' LOCATION 'hdfs://c16f1n07.gpfs.net:8020/user/hive/local_db/passwd_int_part_import'; Copying data from hdfs://c16f1n03.gpfs.net:8020/user/hive/remote_db/passwd_int_part_export/group_id=2011-12-14 Copying file: hdfs://c16f1n03.gpfs.net:8020/user/hive/remote_db/passwd_int_part_export/group_id=2011-12-14/lt101.sorted.txt Loading data to table local_db.passwd_int_part_import partition (group_id=2011-12-14) OK Time taken: 1.166 seconds
- List the directory/file created on the local native HDFS cluster by using the IMPORT
operation.
hive> dfs -ls hdfs://c16f1n07.gpfs.net:8020/user/hive/local_db/passwd_int_part_import; Found 1 items drwxr-xr-x - hdp-user1 hdfs 0 2018-03-19 21:59 hdfs://c16f1n07.gpfs.net:8020/user/hive/local_db/passwd_int_part_import/group_id=2011-12-14
- Query data from the local_db table created by the IMPORT
operation.
hive> select * from local_db.passwd_int_part_import; OK 0 val_0 NULL NULL NULL NULL NULL 2011-12-14 0 val_0 NULL NULL NULL NULL NULL 2011-12-14 0 val_0 NULL NULL NULL NULL NULL 2011-12-14 10 val_10 NULL NULL NULL NULL NULL 2011-12-14 11 val_11 NULL NULL NULL NULL NULL 2011-12-14 12 val_12 NULL NULL NULL NULL NULL 2011-12-14 15 val_15 NULL NULL NULL NULL NULL 2011-12-14 17 val_17 NULL NULL NULL NULL NULL 2011-12-14 18 val_18 NULL NULL NULL NULL NULL 2011-12-14 24 val_24 NULL NULL NULL NULL NULL 2011-12-14 35 val_35 NULL NULL NULL NULL NULL 2011-12-14 35 val_35 NULL NULL NULL NULL NULL 2011-12-14 37 val_37 NULL NULL NULL NULL NULL 2011-12-14 …... Time taken: 0.172 seconds, Fetched: 84 row(s)