You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@doris.apache.org by 41108453 <41...@qq.com.INVALID> on 2023/04/24 10:29:22 UTC

回复:动态分区表的存储策略问题

加我微信我帮你看看:35926237



41108453
41108453@qq.com







                       
原始邮件
                       
                     

发件人:"曾虎"< zenghu@wondertechlabs.com &gt;;

发件时间:2023/4/24 18:22

收件人:"dev@doris.apache.org"< dev@doris.apache.org &gt;;

主题:动态分区表的存储策略问题


CREATE RESOURCE "s3_iot_test"&nbsp; PROPERTIES
&nbsp; (
&nbsp; &nbsp; &nbsp; "type" = "s3",
&nbsp; &nbsp; &nbsp; "AWS_ENDPOINT" = "s3.amazonaws.com",
&nbsp; &nbsp; &nbsp; "AWS_REGION" = "us-east-1",
&nbsp; &nbsp; &nbsp; "AWS_BUCKET" = "wonder-data-warehouse",
&nbsp; &nbsp; &nbsp; "AWS_ROOT_PATH" = "doris/test_db/iot-payload",
&nbsp; &nbsp; &nbsp; "AWS_ACCESS_KEY" = "",
&nbsp; &nbsp; &nbsp; "AWS_SECRET_KEY" = "",
&nbsp; &nbsp; &nbsp; "AWS_MAX_CONNECTIONS" = "50",
&nbsp; &nbsp; &nbsp; "AWS_REQUEST_TIMEOUT_MS" = "3000",
&nbsp; &nbsp; &nbsp; "AWS_CONNECTION_TIMEOUT_MS" = "1000"
&nbsp; );






CREATE STORAGE POLICY test_policy
&nbsp; PROPERTIES(
&nbsp; &nbsp; &nbsp; "storage_resource" = "s3_iot_test",
&nbsp; &nbsp; &nbsp; "cooldown_ttl" = "2d"
&nbsp; );




CREATE TABLE IF NOT EXISTS test_db.iot_test
(
&nbsp; &nbsp; input_date date,
&nbsp; &nbsp; sn &nbsp; &nbsp; &nbsp; &nbsp; varchar(100),
&nbsp; &nbsp; clientid &nbsp; varchar(100),
&nbsp; &nbsp; eventtype &nbsp;varchar(100),
&nbsp; &nbsp; utctime &nbsp; &nbsp;varchar(30),
&nbsp; &nbsp; data &nbsp; &nbsp; &nbsp; varchar(2000)
)
ENGINE = OLAP
DUPLICATE KEY(input_date, sn)
PARTITION BY RANGE(input_date)(FROM ("2023-04-19") TO ("2023-04-21") INTERVAL 1 DAY)
DISTRIBUTED BY HASH(sn) BUCKETS 50
PROPERTIES(
&nbsp; &nbsp; "replication_num" = "2",
&nbsp; &nbsp; "storage_policy" = "test_policy",
&nbsp; &nbsp; "dynamic_partition.enable" = "true",
&nbsp; &nbsp; "dynamic_partition.time_unit" = "DAY",
&nbsp; &nbsp; "dynamic_partition.end" = "1",
&nbsp; &nbsp; "dynamic_partition.prefix" = "p_",
&nbsp; &nbsp; "dynamic_partition.buckets" = "50",
&nbsp; &nbsp; "dynamic_partition.replication_num" = "2"
);


我建了一张表、且设置了冷热分离的存储策略,按天分区,为什么自动产生的新分区没有关联test_policy,难道需要每天手动给新分区关联test_policy吗
ALTER TABLE test_db.iot_test MODIFY PARTITION (new_partition) SET("storage_policy"="test_policy");