create table table2 (
event_day DATE,
siteid int defautl '10',
citycode smallint,
username varchar(32) defautl '',
pv bigint sum default '0'
)
aggregate key (event_day, siteid, citycode, username)
-- 按照event_day做range分区 --
paritition by range(event_day)
(
partition p202106 values less than ('2021-07-01'),
partition p202107 values less than ('2021-08-01'),
partition p202108 values less than ('2021-09-01')
)
distributed by hash(siteid) buckets 10
properties("replication_num" = "3");
数据文件table2_data内容如下,分隔符是竖线(|)
2021-06-03|9|1|jack|3
2021-06-10|10|2|rose|2
2021-07-03|11|1|jim|2
2021-07-05|12|1|grace|2
2021-07-12|13|2|tom|2
2021-08-15|14|3|bush|2
2021-08-12|15|4|helen|3
curl --location-trusted -u root:123456 -H “label:table2_20210707” -H “column_separator: |” -T table2_data http://node01:8030/api/test_db/table2/_stream_load