Dav*_*itz 0 hadoop hive hiveql apache-spark apache-spark-sql
例如生成1G记录,其序号在1到1G之间。
创建分区种子表
create table seed (i int)
partitioned by (p int)
Run Code Online (Sandbox Code Playgroud)
用序号在 0 到 999 之间的1K记录填充种子表。
每条记录都被插入到不同的分区中,因此位于不同的 HDFS 目录上,更重要的是位于不同的文件上。
PS
需要以下一组
set hive.exec.dynamic.partition.mode=nonstrict;
set hive.exec.max.dynamic.partitions.pernode=1000;
set hive.hadoop.supports.splittable.combineinputformat=false;
set hive.input.format=org.apache.hadoop.hive.ql.io.HiveInputFormat;
Run Code Online (Sandbox Code Playgroud)
insert into table seed partition (p)
select i,i
from (select 1) x lateral view posexplode (split (space (999),' ')) e as i,x
Run Code Online (Sandbox Code Playgroud)
生成一个有1G记录的表。
种子表中的每条1K记录都位于不同的文件中,并且由不同的容器读取。
每个容器生成1M条记录。
create table t1g
as
select s.i*1000000 + e.i + 1 as n
from seed s lateral view posexplode (split (space (1000000-1),' ')) e as i,x
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1847 次 |
| 最近记录: |