Error

An error occurred.

Sorry, the page you are looking for is currently unavailable.
Please try again later.

If you are the system administrator of this resource then you should check the error log for details.

Faithfully yours, nginx.

帮助文档(华北一、二)

  • ● 1. 创建目标分区的表。

     
    hive> create table t_part (id int, name string) partitioned by (stat_date 
    string , province string);

    ● 2. 导入外部表。 创建外部表(创建外部表的开销几乎为0):

     
    CREATE external TABLE ext( id INT, name string, stat_date string, province 
    string) ROW format delimited FIELDS TERMINATED BY ' ' LINES TERMINATED BY 
    '\n' stored AS textfile location '/data/x.txt';

    ● 3. 将分区信息到入到目标表中

     
    hive> set hive.exec.dynamic.partition=true; 
    hive> set hive.exec.dynamic.partition.mode=nostrict; 
    hive> insert into t_part partition(stat_date, province) select * from ext;

    原理:partition只是相当于对原来的表额外增加了列,所以只要把原始数据按照对应的列拼好一行数据就可以实现自动分区了。

     
    性能统计: 
    环境:2cpu/6G core节点 
    数据量:28G   1,138,816,944 行 
    时间: 
    Total MapReduce CPU Time Spent: 0 days 1 hours 19 minutes 32 seconds 330 msec

文档是否已解决您的问题?

  已解决   未解决

如您有其它疑问,您也可以与我们技术专家联系探讨。

联系技术专家