Starrocks 3.1.9迁移doris,建表语句有问题

Viewed 148

starrocks版本3.1.9,doris 2.1,x2doris 1.0.3
表结构:

CREATE TABLE `T1` (
  `field1` varchar(255) NULL COMMENT "",
  `field2` varchar(255) NULL COMMENT "",
  `field3` varchar(255) NULL COMMENT "",
  `field4` varchar(255) NULL COMMENT "",
  `field5` varchar(255) NULL COMMENT "",
  `field6` varchar(255) NULL COMMENT "",
  `field7` varchar(255) NULL COMMENT "",
  `field8` varchar(255) NULL COMMENT "",
  `field9` varchar(255) NULL COMMENT "",
  `field10` varchar(255) NULL COMMENT ""
) ENGINE=OLAP 
DUPLICATE KEY(`field1`)
DISTRIBUTED BY HASH(`field1`) BUCKETS 1 
PROPERTIES (
"replication_num" = "3",
"in_memory" = "false",
"enable_persistent_index" = "false",
"replicated_storage" = "true",
"compression" = "LZ4"
);

x2doris识别为:

CREATE TABLE `T1` (
  `field1` string, NULL COMMENT "",
  `field2` string, NULL COMMENT "",
  `field3` string, NULL COMMENT "",
  `field4` string, NULL COMMENT "",
  `field5` string, NULL COMMENT "",
  `field6` string, NULL COMMENT "",
  `field7` string, NULL COMMENT "",
  `field8` string, NULL COMMENT "",
  `field9` string, NULL COMMENT "",
  `field10` string, NULL COMMENT ""
) ENGINE=OLAP 
DUPLICATE KEY(`field1`)
DISTRIBUTED BY HASH(`field1`) BUCKETS 1 
PROPERTIES (
"replication_num" = "3",
"in_memory" = "false",
"compression" = "LZ4"
);

string后面会多个 , 并且建表失败,key里列不能为string

4 Answers

已知问题,你在 conf 的目录下找到 type-mapping.yml 这个文件,把下面这几个参数都改成对应的就行,不要用命令转换

比如 varchar: varchar
image.png

这个是一个已知问题,sr和Doris对于key列的约束不一致,这里可以手动调整一下列类型

为什么要迁移到doris,starrocks不好用吗