2.05-rc02 分桶键 varchar类型长度修改后无法自动创建分区

Viewed 16

分桶键类型从 varchar(24) 修改为 varchar(200) ,自动创建分区失败

通过 show dynamic partition tables;
查看到

errCode = 2, detailMessage = Cannot assign hash distribution with different distribution cols. new is: [`phone_no` varchar(200) NULL COMMENT '计费号码'] default is: [`phone_no` varchar(24) NULL COMMENT '计费号码']

通过如下方式进行复现

CREATE TABLE `shi_test` (
   jtime DATETIME  COMMENT '时间',
   prov_code char(2)  COMMENT   '省编码',
   phone_no   VARCHAR(200) COMMENT  '计费号码'
)
ENGINE = OLAP
DUPLICATE KEY(jc_time,prov_code)
COMMENT "测试分区问题"
PARTITION BY RANGE (`jtime`) ()
DISTRIBUTED BY HASH(`phone_no`) BUCKETS AUTO
PROPERTIES (
  "replication_allocation" = "tag.location.default: 3",
  "dynamic_partition.enable" = "true",
  "dynamic_partition.time_unit" = "HOUR",
  "dynamic_partition.start" = "-3",
  "dynamic_partition.end" = "3",
  "dynamic_partition.prefix" = "jc2",
  "dynamic_partition.create_history_partition" = "true",
  "dynamic_partition.history_partition_num" = "10"
);
ALTER TABLE shi_test MODIFY COLUMN phone_no  VARCHAR(200) COMMENT  '计费号码';

在 github 找到了类似的issue,应该是合并到2.0.4版本了,我这里还是2.0.5版本能够复现

https://github.com/apache/doris/issues/28226

1 Answers

这个问题,需要重新创建新表,旧表还是有问题的,目前禁止掉了修改分桶字段这一操作。