使用Doris执行以下建表语句
CREATE TABLE ods.ods_log_data
(
`action` INT COMMENT 'action',
`mac` VARCHAR(255) COMMENT 'mac',
`coll_id` VARCHAR(255) COMMENT '专辑id',
`coll_name` VARCHAR(255) COMMENT '专辑名称',
`video_id` VARCHAR(255) COMMENT '视频ID',
`video_name` VARCHAR(255) COMMENT '视频ID',
`channel_id` INT COMMENT '频道ID',
`content_source` INT COMMENT '内容源',
`play_dur` BIGINT COMMENT '播放时长',
`play_type` INT COMMENT '播放类型',
`video_type` INT COMMENT '视频类型',
`ls` INT COMMENT '日志序号',
`time` DATETIME COMMENT '时间'
)
DUPLICATE KEY(`time`,`action`,`mac`)
COMMENT "日志数据"
PARTITION BY RANGE(`time`) ()
DISTRIBUTED BY HASH(`mac`)
PROPERTIES (
"dynamic_partition.enable" = "true",
"dynamic_partition.time_unit" = "MONTH",
"dynamic_partition.end" = "3",
"dynamic_partition.prefix" = "p",
"dynamic_partition.buckets" = "16"
)
报错了
[1105] [HY000]: errCode = 2, detailMessage = Key columns should be a ordered prefix of the schema.文章来源:https://www.toymoban.com/news/detail-501730.html
这是因为建表语句中的列顺序与DUPLICATE KEY指定的排序列顺序不一致导致的
调整一下建表语句中的列顺序问题解决文章来源地址https://www.toymoban.com/news/detail-501730.html
CREATE TABLE ods.ods_log_data
(
`time` DATETIME COMMENT '时间',
`action` INT COMMENT 'action',
`mac` VARCHAR(255) COMMENT 'mac',
`coll_id` VARCHAR(255) COMMENT '专辑id',
`coll_name` VARCHAR(255) COMMENT '专辑名称',
`video_id` VARCHAR(255) COMMENT '视频ID',
`video_name` VARCHAR(255) COMMENT '视频ID',
`channel_id` INT COMMENT '频道ID',
`content_source` INT COMMENT '内容源',
`play_dur` BIGINT COMMENT '播放时长',
`play_type` INT COMMENT '播放类型',
`video_type` INT COMMENT '视频类型',
`ls` INT COMMENT '日志序号'
)
DUPLICATE KEY(`time`,`action`,`mac`)
COMMENT "日志数据"
PARTITION BY RANGE(`time`) ()
DISTRIBUTED BY HASH(`mac`)
PROPERTIES (
"dynamic_partition.enable" = "true",
"dynamic_partition.time_unit" = "MONTH",
"dynamic_partition.end" = "3",
"dynamic_partition.prefix" = "p",
"dynamic_partition.buckets" = "16"
)
到了这里,关于【Doris】[1105] [HY000]: errCode = 2, detailMessage = Key columns should be a ordered prefix of the sc的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!