SQL示例
CREATE TABLE `test` (
`date` int(11) NOT NULL DEFAULT "0" COMMENT "日期",
`city` varchar(64) NOT NULL DEFAULT "" COMMENT "城市",
`category` varchar(64) NOT NULL DEFAULT "" COMMENT "类目",
`show_pv` int(11) REPLACE NULL DEFAULT "0" COMMENT "展现uv",
`exposure_pv` int(11) REPLACE NULL DEFAULT "0" COMMENT "曝光uv",
) ENGINE=OLAP
AGGREGATE KEY(`event_date`, `city`, `category`)
COMMENT "本地生活可召回数据"
DISTRIBUTED BY HASH(`event_date`) BUCKETS 32
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"in_memory" = "false",
"storage_format" = "V2"
);
detailMessage = AGG_KEYS table should specify aggregate type for non-key column[category]
将 category 加到 AGGREGATE KEY里
detailMessage = Key columns should be a ordered prefix of the schema.
AGGREGATE KEY对应字段,必须在表结构前面
比如:event_date
, city
, category
是key,就必须再前面,show_pv 和exposure_pv 在后面
参考文档:https://doris.apache.org/zh-CN/docs/dev/data-table/data-partition/