doris 字符串字段list分区

分区列支持 BOOLEAN, TINYINT, SMALLINT, INT, BIGINT, LARGEINT, DATE, DATETIME, CHAR, VARCHAR 数据类型,分区值为枚举值。只有当数据为目标分区枚举值其中之一时,才可以命中分区。

CREATE TABLE `table1` (
  `BUKRS` varchar(12) NULL,
  `GJAHR` varchar(12) NOT NULL,
  `BLART` varchar(6) NULL,
  `BLDAT` datetime NULL,
  `XFREF2` varchar(36) NULL,
  `XFREF3` varchar(60) NULL
) ENGINE=OLAP
UNIQUE KEY(`BUKRS`, `GJAHR`)
COMMENT 'OLAP'
PARTITION BY LIST(`GJAHR`)
(PARTITION p2020 VALUES IN ("2020"),
PARTITION p2021 VALUES IN ("2021"),
PARTITION p2022 VALUES IN ("2022"))
DISTRIBUTED BY HASH(`BUKRS`) BUCKETS 10
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"in_memory" = "false",
"storage_format" = "V2",
"disable_auto_compaction" = "false"
);

ALTER TABLE ads.ads_sap_fidoc1 ADD PARTITION p2031 VALUES in ("2031");

参考链接:

https://doris.apache.org/zh-CN/docs/table-design/data-partition#list-%E5%88%86%E5%8C%BA

 

posted @ 2024-09-21 15:06  所向披靡zz  阅读(56)  评论(0编辑  收藏  举报