create table test_overwrite(a date not null , b int, c int)
duplicate key (a)
PARTITION BY RANGE(a)(
PARTITION p20240828 VALUES LESS THAN ("2024-08-28"),
PARTITION p20240829 VALUES LESS THAN ("2024-08-29"),
PARTITION p20240830 VALUES LESS THAN ("2024-08-30")
)
PROPERTIES(
"dynamic_partition.enable" = "true",
"dynamic_partition.time_unit" = "DAY",
"dynamic_partition.start" = "-3",
"dynamic_partition.end" = "3",
"dynamic_partition.prefix" = "p",
"dynamic_partition.history_partition_num" = "0"
);
show partitions from test_overwrite;
select tracking_log from information_schema.load_tracking_logs where job_id=41737
insert into test_overwrite values('2024-08-27',2,1),('2024-08-28',2,2),('2024-08-29',3,3);
select * from test_overwrite;
insert overwrite test_overwrite partition (p20240828,p20240829,p20240830) select * from test_overwrite union all select '2024-08-30',4,4;
这样也不行
写入时不会动态创建分区的
Error: The row is out of partition ranges. Please add a new partition… Row: [2024-08-30, 4, 4]