1. 解决Key columns should be a ordered prefix of the schema. KeyColumns[1] (starts from zero) is xxx, but
背景
create table if not exists XXX (
`fathercorp` varchar(50),
`id` decimalv3(38,0)
) ENGINE=OLAP
UNIQUE KEY(`id`)
COMMENT 'xxxx'
DISTRIBUTED BY HASH(`id`) BUCKETS 10
PROPERTIES (
"replication_allocation" = "tag.location.default: 3",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"store_row_column" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);
解决方案:
将错误Key columns should be a ordered prefix of the schema. KeyColumns[1] (starts from zero) is aa, but corresponding column is bb in the previous columns declaration.
由于UNIQUE KEY(`id`)中的字段必须为DDL建表语句的第一列,有顺序关系,然后问题解决
2.关于由于源表Oracle字段类型长度引起的错误
具体详细原因:
因为我们建表的时候,也是依据Oracle源表的字段长度进行建表的,如果在Doris中进行建表,字段长度类型尽可能的大一点,这样可以避免这种错误