非分区表
CREATE TABLE `entity_50_dictionary` (
`code` varchar(1024) NOT NULL,
`parent_key` varchar(1024) NOT NULL ,
`value` varchar(1024) NOT NULL,
`ordinal` int(11) REPLACE NOT NULL,
`alias` varchar(1024) REPLACE NULL L,
`level` int(11) REPLACE NULLL,
`update_time` datetime REPLACE NOT NULL
) ENGINE=OLAP
AGGREGATE KEY(`code`, `parent_key`, `value`)
DISTRIBUTED BY HASH(`code`, `parent_key`, `value`) BUCKETS 3
PROPERTIES (
"replication_num" = "3",
"in_memory" = "false",
"storage_format" = "DEFAULT",
"enable_persistent_index" = "false"
);
分区表
CREATE TABLE `cd_dm_label_user_after_sale_info` (
`dt` date NULL ,
`user_id` varchar(255) NOT NULL,
`return_goods_num_1m` bigint(20) NOT NULL,
`return_goods_num_3m` bigint(20) NOT NULL,
`return_goods_num_6m` bigint(20) NOT NULL,
`return_goods_num_12m` bigint(20) NOT NULL,
`complaint_num_1m` bigint(20) NOT NULL,
`complaint_num_3m` bigint(20) NOT NULL,
`complaint_num_6m` bigint(20) NOT NULL,
`complaint_num_12m` bigint(20) NOT NULL,
`etl_load_time` datetime NULL COMMENT
) ENGINE=OLAP
UNIQUE KEY(`dt`, `user_id`)
PARTITION BY RANGE(`dt`)
(
START ("2021-01-01") END ("2023-01-06") EVERY (INTERVAL 1 DAY)
)
DISTRIBUTED BY HASH(`user_id`) BUCKETS 3
PROPERTIES (
"replication_num" = "3",
"dynamic_partition.enable" = "true",
"dynamic_partition.time_unit" = "DAY",
"dynamic_partition.time_zone" = "Asia/Shanghai",
"dynamic_partition.start" = "-2147483648",
"dynamic_partition.end" = "2",
"dynamic_partition.prefix" = "p",
"dynamic_partition.buckets" = "16",
"in_memory" = "false",
"storage_format" = "DEFAULT",
"enable_persistent_index" = "false"
);