【详述】建表指定多个hash键报错,报错信息如标题所示。
【StarRocks版本】例如:2.2.2
建表语句如下所示:
CREATE TABLE dm.dm_skincare_profile
(
month
date NOT NULL COMMENT “发帖月份”,
tag_name varchar(150) not null comment “标签名称”,
user_id varchar(2000) not null comment “用户ID”,
is_valid
tinyint NOT NULL COMMENT “标签是否有效:1-有效,0-无效”
) ENGINE=OLAP
UNIQUE KEY(month
, tag_name
, user_id
)
COMMENT “集市人群画像表”
PARTITION BY RANGE(month
)
(PARTITION p201904 VALUES [(‘2019-04-01’), (‘2019-05-01’)),
PARTITION p201905 VALUES [(‘2019-05-01’), (‘2019-06-01’)),
PARTITION p201906 VALUES [(‘2019-06-01’), (‘2019-07-01’)),
PARTITION p201907 VALUES [(‘2019-07-01’), (‘2019-08-01’)),
PARTITION p201908 VALUES [(‘2019-08-01’), (‘2019-09-01’)),
PARTITION p201909 VALUES [(‘2019-09-01’), (‘2019-10-01’)),
PARTITION p201910 VALUES [(‘2019-10-01’), (‘2019-11-01’)),
PARTITION p201911 VALUES [(‘2019-11-01’), (‘2019-12-01’)),
PARTITION p201912 VALUES [(‘2019-12-01’), (‘2020-01-01’)),
PARTITION p202001 VALUES [(‘2020-01-01’), (‘2020-02-01’)),
PARTITION p202002 VALUES [(‘2020-02-01’), (‘2020-03-01’)),
PARTITION p202003 VALUES [(‘2020-03-01’), (‘2020-04-01’)),
PARTITION p202004 VALUES [(‘2020-04-01’), (‘2020-05-01’)),
PARTITION p202005 VALUES [(‘2020-05-01’), (‘2020-06-01’)),
PARTITION p202006 VALUES [(‘2020-06-01’), (‘2020-07-01’)),
PARTITION p202007 VALUES [(‘2020-07-01’), (‘2020-08-01’)),
PARTITION p202008 VALUES [(‘2020-08-01’), (‘2020-09-01’)),
PARTITION p202009 VALUES [(‘2020-09-01’), (‘2020-10-01’)),
PARTITION p202010 VALUES [(‘2020-10-01’), (‘2020-11-01’)),
PARTITION p202011 VALUES [(‘2020-11-01’), (‘2020-12-01’)),
PARTITION p202012 VALUES [(‘2020-12-01’), (‘2021-01-01’)),
PARTITION p202101 VALUES [(‘2021-01-01’), (‘2021-02-01’)),
PARTITION p202102 VALUES [(‘2021-02-01’), (‘2021-03-01’)),
PARTITION p202103 VALUES [(‘2021-03-01’), (‘2021-04-01’)),
PARTITION p202104 VALUES [(‘2021-04-01’), (‘2021-05-01’)),
PARTITION p202105 VALUES [(‘2021-05-01’), (‘2021-06-01’)),
PARTITION p202106 VALUES [(‘2021-06-01’), (‘2021-07-01’)),
PARTITION p202107 VALUES [(‘2021-07-01’), (‘2021-08-01’)),
PARTITION p202108 VALUES [(‘2021-08-01’), (‘2021-09-01’)),
PARTITION p202109 VALUES [(‘2021-09-01’), (‘2021-10-01’)),
PARTITION p202110 VALUES [(‘2021-10-01’), (‘2021-11-01’)),
PARTITION p202111 VALUES [(‘2021-11-01’), (‘2021-12-01’)),
PARTITION p202112 VALUES [(‘2021-12-01’), (‘2022-01-01’)),
PARTITION p202201 VALUES [(‘2022-01-01’), (‘2022-02-01’)),
PARTITION p202202 VALUES [(‘2022-02-01’), (‘2022-03-01’)),
PARTITION p202203 VALUES [(‘2022-03-01’), (‘2022-04-01’)),
PARTITION p202204 VALUES [(‘2022-04-01’), (‘2022-05-01’)),
PARTITION p202205 VALUES [(‘2022-05-01’), (‘2022-06-01’)),
PARTITION p202206 VALUES [(‘2022-06-01’), (‘2022-07-01’)),
PARTITION p202207 VALUES [(‘2022-07-01’), (‘2022-08-01’)),
PARTITION p202208 VALUES [(‘2022-08-01’), (‘2022-09-01’)),
PARTITION p202209 VALUES [(‘2022-09-01’), (‘2022-10-01’)),
PARTITION p202210 VALUES [(‘2022-10-01’), (‘2022-11-01’)),
PARTITION p202211 VALUES [(‘2022-11-01’), (‘2022-12-01’)))
DISTRIBUTED BY HASH(tag_name,user_id) BUCKETS 32
PROPERTIES (
“replication_num” = “3”,
“colocate_with” = “cgs_industry_skincare”,
“dynamic_partition.enable” = “true”,
“dynamic_partition.time_unit” = “MONTH”,
“dynamic_partition.time_zone” = “Asia/Shanghai”,
“dynamic_partition.start” = “-2147483648”,
“dynamic_partition.end” = “1”,
“dynamic_partition.prefix” = “p”,
“dynamic_partition.buckets” = “32”,
“dynamic_partition.start_day_of_month” = “1”,
“in_memory” = “false”,
“storage_format” = “DEFAULT”
);