0

I have a table A in cluster X.

I want to perform some HQL (say select * from A where A.country = 'INDIA') & save output in table B in cluster Y.

I can perform HQL on table A & store data in table temp. Then, export this hive table to table B in cluster Y using:

EXPORT TABLE temp TO 'path/to/hdfs_clusterX';

hadoop distcp hdfs:///path/to/hdfs_clusterX hdfs:///path/to/hdfs_clusterY

IMPORT TABLE Y FROM 'path/to/another/hdfs

Is there any other better way rather than creating this table temp?

4

1 回答 1

0

select * from A where A.country = 'INDIA';

将上面的选择结果插入到其他表中,然后使用以下命令将其导出到集群上的某个位置:假设表名是 test

将表测试导出到“/路径”;

之后使用 distcp 命令将其移动到另一个集群

hadoop distcp 源路径 目标路径 ;

于 2016-01-18T20:06:11.440 回答