Skip to content

Commit

Permalink
[Doc] Update dynamic partition docs (#54366)
Browse files Browse the repository at this point in the history
Signed-off-by: 絵空事スピリット <[email protected]>
Co-authored-by: 絵空事スピリット <[email protected]>
(cherry picked from commit 39ddce9)
  • Loading branch information
INNOCENT-BOY authored and mergify[bot] committed Dec 26, 2024
1 parent da94c0d commit fa3a38b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
13 changes: 12 additions & 1 deletion docs/en/table_design/data_distribution/dynamic_partitioning.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,18 @@ PROPERTIES(

## View partitions

After you enable dynamic partitions for a table, the input data is continuously and automatically partitioned. You can view the current partitions by using the following statement. For example, if the current date is 2020-03-25, you can only see partitions in the time range from 2020-03-22 to 2020-03-28.
After you enable dynamic partitions for a table, the input data is continuously and automatically partitioned. You can view the current partitions by using the following statement. For example, if the current date is 2020-03-25, you can only see partitions in the time range from 2020-03-25 to 2020-03-28.

```SQL
SHOW PARTITIONS FROM site_access;

[types: [DATE]; keys: [2020-03-25]; ‥types: [DATE]; keys: [2020-03-26]; )
[types: [DATE]; keys: [2020-03-26]; ‥types: [DATE]; keys: [2020-03-27]; )
[types: [DATE]; keys: [2020-03-27]; ‥types: [DATE]; keys: [2020-03-28]; )
[types: [DATE]; keys: [2020-03-28]; ‥types: [DATE]; keys: [2020-03-29]; )
```

If you want to create historical partitions when creating a table, you need to specify `dynamic_partition.history_partition_num` to define the number of historical partitions to be created. For example, if you set `dynamic_partition.history_partition_num` to `3` during table creation and the current date is 2020-03-25, you will only see partitions in the time range from 2020-03-22 to 2020-03-28.

```SQL
SHOW PARTITIONS FROM site_access;
Expand Down
10 changes: 10 additions & 0 deletions docs/zh/table_design/data_distribution/dynamic_partitioning.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@ SHOW PARTITIONS FROM site_access;

假设当前时间为 2020-03-25,在调度动态分区时,会删除分区上界小于 2020-03-22 的分区,同时在调度时会创建今后 3 天的分区。则如上语句的返回结果中,`Range` 列显示当前分区的信息如下:

```SQL
[types: [DATE]; keys: [2020-03-25]; ‥types: [DATE]; keys: [2020-03-26]; )
[types: [DATE]; keys: [2020-03-26]; ‥types: [DATE]; keys: [2020-03-27]; )
[types: [DATE]; keys: [2020-03-27]; ‥types: [DATE]; keys: [2020-03-28]; )
[types: [DATE]; keys: [2020-03-28]; ‥types: [DATE]; keys: [2020-03-29]; )
```

如果你希望在建表时同时创建历史分区,需要指定 `dynamic_partition.history_partition_num` 来定义要创建的历史分区数量。在建表时指定 `dynamic_partition.history_partition_num``3`
则会创建过去 3 天的历史分区,则如上语句的返回结果中,`Range` 列显示当前分区的信息如下:

```SQL
[types: [DATE]; keys: [2020-03-22]; ‥types: [DATE]; keys: [2020-03-23]; )
[types: [DATE]; keys: [2020-03-23]; ‥types: [DATE]; keys: [2020-03-24]; )
Expand Down

0 comments on commit fa3a38b

Please sign in to comment.