CREATE TABLE `wjx_ods_platform_order_center_poc_order_item_01` (
`dt` date NOT NULL,
`order_item_id` bigint NOT NULL COMMENT '订单明细id',
`order_id` bigint NOT NULL COMMENT '订单id',
`id` bigint NOT NULL COMMENT '主键',
INDEX idx_order_id (`order_id`) USING INVERTED
) ENGINE = OLAP UNIQUE KEY(`dt`, `order_item_id`) AUTO PARTITION BY RANGE (date_trunc(`dt`, 'day')) ()
DISTRIBUTED BY HASH(`order_item_id`) BUCKETS 10
PROPERTIES (
"file_cache_ttl_seconds" = "0",
"is_being_synced" = "false",
"storage_medium" = "hdd",
"storage_format" = "V2",
"inverted_index_storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"storage_vault_name" = "s3_vault_v4",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false",
"group_commit_interval_ms" = "10000",
"group_commit_data_bytes" = "134217728",
"enable_mow_light_delete" = "false"
);
insert into wjx_ods_platform_order_center_poc_order_item_01 (dt,order_item_id,order_id,id) values ('2025-03-24',1,1,1);
设置数据保留近90天
ALTER TABLE wjx_ods_platform_order_center_poc_order_item_01 SET (
"dynamic_partition.enable" = "true",
"dynamic_partition.time_unit" = "DAY",
"dynamic_partition.start" = "-90",
"dynamic_partition.end" = "2",
"dynamic_partition.prefix" = "p",
"dynamic_partition.create_history_partition" = "true"
);
会自动生成分区,但是分区名称不对,没有 000000