yagagagaga commented on code in PR #1295:
URL: https://github.com/apache/doris-website/pull/1295#discussion_r1833767226


##########
i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/table-design/data-partitioning/basic-concepts.md:
##########
@@ -0,0 +1,186 @@
+---
+{
+    "title": "基本概念",
+    "language": "zh-CN"
+}
+---
+
+<!-- 
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+
+本文档主要介绍 Doris 的建表和数据划分,以及建表操作中可能遇到的问题和解决方法。
+
+
+## Row & Column
+
+在 Doris 中,数据都以表(Table)的形式进行逻辑上的描述。
+
+一张表包括行(Row)和列(Column):
+
+-   Row:即用户的一行数据;
+
+-   Column:用于描述一行数据中不同的字段;
+
+-   Column 可以分为两大类:Key 和 Value。从业务角度看,Key 和 Value 可以分别对应维度列和指标列。Doris 的 key 
列是建表语句中指定的列,建表语句中的关键字'unique key'或'aggregate key'或'duplicate key'后面的列就是 key 
列,除了 key 列剩下的就是 value 列。从聚合模型的角度来说,Key 列相同的行,会聚合成一行。其中 Value 
列的聚合方式由用户在建表时指定。关于更多聚合模型的介绍,可以参阅 [Doris 
数据模型](../table-design/data-model/overview)。

Review Comment:
   ```suggestion
   -   Column 可以分为两大类:Key 和 Value。从业务角度看,Key 和 Value 可以分别对应维度列和指标列。Doris 的 key 
列是建表语句中指定的列,建表语句中的关键字'unique key'或'aggregate key'或'duplicate key'后面的列就是 key 
列,除了 key 列剩下的就是 value 列。从聚合模型的角度来说,Key 列相同的行,会聚合成一行。其中 Value 
列的聚合方式由用户在建表时指定。关于更多聚合模型的介绍,可以参阅 [Doris 
数据模型](../../table-design/data-model/overview)。
   ```



##########
i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/table-design/data-partitioning/manual-partitioning.md:
##########
@@ -0,0 +1,118 @@
+---
+{
+    "title": "手动分区",
+    "language": "zh-CN"
+}
+---
+
+<!-- 
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+
+## 分区列
+
+-   分区列可以指定一列或多列,分区列必须为 KEY 列。多列分区的使用方式在后面多列分区小结介绍。
+
+-   当 `allowPartitionColumnNullable` 为 `true` 时,Range 分区支持使用 NULL 分区列。List 
Partition 始终不支持 NULL 分区列。

Review Comment:
   ```suggestion
   -   当会话变量 `allow_partition_column_nullable` 为 `true` 时,Range 分区支持使用 NULL 
分区列。List Partition 始终不支持 NULL 分区列。
   ```



##########
i18n/zh-CN/docusaurus-plugin-content-docs/current/table-design/data-partitioning/auto-partitioning.md:
##########
@@ -0,0 +1,280 @@
+---
+{
+    "title": "自动分区",
+    "language": "zh-CN"
+}
+---
+
+<!-- 
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+
+## 使用场景
+
+自动分区功能主要解决了用户预期基于某列对表进行分区操作,但该列的数据分布比较零散或者难以预测,在建表或调整表结构时难以准确创建所需分区,或者分区数量过多以至于手动创建过于繁琐的问题。
+
+以时间类型分区列为例,在动态分区功能中,我们支持了按特定时间周期自动创建新分区以容纳实时数据。对于实时的用户行为日志等场景该功能基本能够满足需求。但在一些更复杂的场景下,例如处理非实时数据时,分区列与当前系统时间无关,且包含大量离散值。此时为提高效率我们希望依据此列对数据进行分区,但数据实际可能涉及的分区无法预先掌握,或者预期所需分区数量过大。这种情况下动态分区或者手动创建分区无法满足我们的需求,自动分区功能很好地覆盖了此类需求。
+
+假设我们的表 DDL 如下:
+
+```sql
+CREATE TABLE `DAILY_TRADE_VALUE`
+(
+    `TRADE_DATE`              datev2 NOT NULL COMMENT '交易日期',
+    `TRADE_ID`                varchar(40) NOT NULL COMMENT '交易编号',
+    ......
+)
+UNIQUE KEY(`TRADE_DATE`, `TRADE_ID`)
+PARTITION BY RANGE(`TRADE_DATE`)
+(
+    PARTITION p_2000 VALUES [('2000-01-01'), ('2001-01-01')),
+    PARTITION p_2001 VALUES [('2001-01-01'), ('2002-01-01')),
+    PARTITION p_2002 VALUES [('2002-01-01'), ('2003-01-01')),
+    PARTITION p_2003 VALUES [('2003-01-01'), ('2004-01-01')),
+    PARTITION p_2004 VALUES [('2004-01-01'), ('2005-01-01')),
+    PARTITION p_2005 VALUES [('2005-01-01'), ('2006-01-01')),
+    PARTITION p_2006 VALUES [('2006-01-01'), ('2007-01-01')),
+    PARTITION p_2007 VALUES [('2007-01-01'), ('2008-01-01')),
+    PARTITION p_2008 VALUES [('2008-01-01'), ('2009-01-01')),
+    PARTITION p_2009 VALUES [('2009-01-01'), ('2010-01-01')),
+    PARTITION p_2010 VALUES [('2010-01-01'), ('2011-01-01')),
+    PARTITION p_2011 VALUES [('2011-01-01'), ('2012-01-01')),
+    PARTITION p_2012 VALUES [('2012-01-01'), ('2013-01-01')),
+    PARTITION p_2013 VALUES [('2013-01-01'), ('2014-01-01')),
+    PARTITION p_2014 VALUES [('2014-01-01'), ('2015-01-01')),
+    PARTITION p_2015 VALUES [('2015-01-01'), ('2016-01-01')),
+    PARTITION p_2016 VALUES [('2016-01-01'), ('2017-01-01')),
+    PARTITION p_2017 VALUES [('2017-01-01'), ('2018-01-01')),
+    PARTITION p_2018 VALUES [('2018-01-01'), ('2019-01-01')),
+    PARTITION p_2019 VALUES [('2019-01-01'), ('2020-01-01')),
+    PARTITION p_2020 VALUES [('2020-01-01'), ('2021-01-01')),
+    PARTITION p_2021 VALUES [('2021-01-01'), ('2022-01-01'))
+)
+DISTRIBUTED BY HASH(`TRADE_DATE`) BUCKETS 10
+PROPERTIES (
+  "replication_num" = "1"
+);
+```
+
+
+
+该表内存储了大量业务历史数据,依据交易发生的日期进行分区。可以看到在建表时,我们需要预先手动创建分区。如果分区列的数据范围发生变化,例如上表中增加了 
2022 
年的数据,则我们需要通过[ALTER-TABLE-PARTITION](../sql-manual/sql-statements/Data-Definition-Statements/Alter/ALTER-TABLE-PARTITION)对表的分区进行更改。如果这种分区需要变更,或者进行更细粒度的细分,修改起来非常繁琐。此时我们就可以使用
 AUTO PARTITION 改写该表 DDL。
+
+## 语法
+
+建表时,使用以下语法填充[CREATE-TABLE](../sql-manual/sql-statements/Data-Definition-Statements/Create/CREATE-TABLE)时的`partition_info`部分:

Review Comment:
   ```suggestion
   
建表时,使用以下语法填充[CREATE-TABLE](../../sql-manual/sql-statements/Data-Definition-Statements/Create/CREATE-TABLE)时的`partition_info`部分:
   ```



##########
i18n/zh-CN/docusaurus-plugin-content-docs/current/table-design/data-partitioning/auto-partitioning.md:
##########
@@ -0,0 +1,280 @@
+---
+{
+    "title": "自动分区",
+    "language": "zh-CN"
+}
+---
+
+<!-- 
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+
+## 使用场景
+
+自动分区功能主要解决了用户预期基于某列对表进行分区操作,但该列的数据分布比较零散或者难以预测,在建表或调整表结构时难以准确创建所需分区,或者分区数量过多以至于手动创建过于繁琐的问题。
+
+以时间类型分区列为例,在动态分区功能中,我们支持了按特定时间周期自动创建新分区以容纳实时数据。对于实时的用户行为日志等场景该功能基本能够满足需求。但在一些更复杂的场景下,例如处理非实时数据时,分区列与当前系统时间无关,且包含大量离散值。此时为提高效率我们希望依据此列对数据进行分区,但数据实际可能涉及的分区无法预先掌握,或者预期所需分区数量过大。这种情况下动态分区或者手动创建分区无法满足我们的需求,自动分区功能很好地覆盖了此类需求。
+
+假设我们的表 DDL 如下:
+
+```sql
+CREATE TABLE `DAILY_TRADE_VALUE`
+(
+    `TRADE_DATE`              datev2 NOT NULL COMMENT '交易日期',
+    `TRADE_ID`                varchar(40) NOT NULL COMMENT '交易编号',
+    ......
+)
+UNIQUE KEY(`TRADE_DATE`, `TRADE_ID`)
+PARTITION BY RANGE(`TRADE_DATE`)
+(
+    PARTITION p_2000 VALUES [('2000-01-01'), ('2001-01-01')),
+    PARTITION p_2001 VALUES [('2001-01-01'), ('2002-01-01')),
+    PARTITION p_2002 VALUES [('2002-01-01'), ('2003-01-01')),
+    PARTITION p_2003 VALUES [('2003-01-01'), ('2004-01-01')),
+    PARTITION p_2004 VALUES [('2004-01-01'), ('2005-01-01')),
+    PARTITION p_2005 VALUES [('2005-01-01'), ('2006-01-01')),
+    PARTITION p_2006 VALUES [('2006-01-01'), ('2007-01-01')),
+    PARTITION p_2007 VALUES [('2007-01-01'), ('2008-01-01')),
+    PARTITION p_2008 VALUES [('2008-01-01'), ('2009-01-01')),
+    PARTITION p_2009 VALUES [('2009-01-01'), ('2010-01-01')),
+    PARTITION p_2010 VALUES [('2010-01-01'), ('2011-01-01')),
+    PARTITION p_2011 VALUES [('2011-01-01'), ('2012-01-01')),
+    PARTITION p_2012 VALUES [('2012-01-01'), ('2013-01-01')),
+    PARTITION p_2013 VALUES [('2013-01-01'), ('2014-01-01')),
+    PARTITION p_2014 VALUES [('2014-01-01'), ('2015-01-01')),
+    PARTITION p_2015 VALUES [('2015-01-01'), ('2016-01-01')),
+    PARTITION p_2016 VALUES [('2016-01-01'), ('2017-01-01')),
+    PARTITION p_2017 VALUES [('2017-01-01'), ('2018-01-01')),
+    PARTITION p_2018 VALUES [('2018-01-01'), ('2019-01-01')),
+    PARTITION p_2019 VALUES [('2019-01-01'), ('2020-01-01')),
+    PARTITION p_2020 VALUES [('2020-01-01'), ('2021-01-01')),
+    PARTITION p_2021 VALUES [('2021-01-01'), ('2022-01-01'))
+)
+DISTRIBUTED BY HASH(`TRADE_DATE`) BUCKETS 10
+PROPERTIES (
+  "replication_num" = "1"
+);
+```
+
+
+
+该表内存储了大量业务历史数据,依据交易发生的日期进行分区。可以看到在建表时,我们需要预先手动创建分区。如果分区列的数据范围发生变化,例如上表中增加了 
2022 
年的数据,则我们需要通过[ALTER-TABLE-PARTITION](../sql-manual/sql-statements/Data-Definition-Statements/Alter/ALTER-TABLE-PARTITION)对表的分区进行更改。如果这种分区需要变更,或者进行更细粒度的细分,修改起来非常繁琐。此时我们就可以使用
 AUTO PARTITION 改写该表 DDL。
+
+## 语法
+
+建表时,使用以下语法填充[CREATE-TABLE](../sql-manual/sql-statements/Data-Definition-Statements/Create/CREATE-TABLE)时的`partition_info`部分:
+
+1. AUTO RANGE PARTITION:
+
+   ```sql
+   AUTO PARTITION BY RANGE (FUNC_CALL_EXPR)
+   (
+   )
+   ```
+
+   
+
+   其中
+
+   ```sql
+   FUNC_CALL_EXPR ::= date_trunc ( <partition_column>, '<interval>' )
+   ```
+
+   
+
+​      注意:在 2.1.0 版本,`FUNC_CALL_EXPR` 外围不需要被括号包围。
+
+2. AUTO LIST PARTITION:
+
+```sql
+AUTO PARTITION BY LIST(`partition_col`)
+(
+)
+```
+
+
+
+### 用法示例
+
+1. AUTO RANGE PARTITION
+
+   ```sql
+   CREATE TABLE `date_table` (
+       `TIME_STAMP` datev2 NOT NULL COMMENT '采集日期'
+   ) ENGINE=OLAP
+   DUPLICATE KEY(`TIME_STAMP`)
+   AUTO PARTITION BY RANGE (date_trunc(`TIME_STAMP`, 'month'))
+   (
+   )
+   DISTRIBUTED BY HASH(`TIME_STAMP`) BUCKETS 10
+   PROPERTIES (
+   "replication_allocation" = "tag.location.default: 1"
+   );
+   ```
+
+   
+
+2. AUTO LIST PARTITION
+
+   ```sql
+   CREATE TABLE `str_table` (
+       `str` varchar not null
+   ) ENGINE=OLAP
+   DUPLICATE KEY(`str`)
+   AUTO PARTITION BY LIST (`str`)
+   (
+   )
+   DISTRIBUTED BY HASH(`str`) BUCKETS 10
+   PROPERTIES (
+   "replication_allocation" = "tag.location.default: 1"
+   );
+   ```
+
+### 约束
+
+1. 在 AUTO LIST PARTITION 中,**分区名长度不得超过 50**. 
该长度来自于对应数据行上各分区列内容的拼接与转义,因此实际容许长度可能更短。
+2. 在 AUTO RANGE PARTITION 中,分区函数仅支持 `date_trunc`,分区列仅支持 `DATE` 或者 `DATETIME` 
类型;
+3. 在 AUTO LIST PARTITION 中,不支持函数调用,分区列支持 `BOOLEAN`, `TINYINT`, `SMALLINT`, 
`INT`, `BIGINT`, `LARGEINT`, `DATE`, `DATETIME`, `CHAR`, `VARCHAR` 数据类型,分区值为枚举值。
+4. 在 AUTO LIST PARTITION 中,分区列的每个当前不存在对应分区的取值,都会创建一个独立的新 PARTITION。
+
+### NULL 值分区
+
+当开启 session variable `allow_partition_column_nullable` 后,LIST 和 RANGE 分区都支持 
NULL 列作为分区列。当分区列实际遇到 NULL 值的插入时:
+
+1. 对于 AUTO LIST PARTITION,会自动创建对应的 NULL 值分区:
+
+```sql
+mysql> create table auto_null_list(
+    -> k0 varchar null
+    -> )
+    -> auto partition by list (k0)
+    -> (
+    -> )
+    -> DISTRIBUTED BY HASH(`k0`) BUCKETS 1
+    -> properties("replication_num" = "1");
+Query OK, 0 rows affected (0.10 sec)
+
+mysql> insert into auto_null_list values (null);
+Query OK, 1 row affected (0.28 sec)
+
+mysql> select * from auto_null_list;
++------+
+| k0   |
++------+
+| NULL |
++------+
+1 row in set (0.20 sec)
+
+mysql> select * from auto_null_list partition(pX);
++------+
+| k0   |
++------+
+| NULL |
++------+
+1 row in set (0.20 sec)
+```
+
+
+
+1. 对于 AUTO RANGE PARTITION,**不支持 NULLABLE 列作为分区列**。
+
+```sql
+mysql>  CREATE TABLE `range_table_nullable` (
+    ->      `k1` INT,
+    ->      `k2` DATETIMEV2(3),
+    ->      `k3` DATETIMEV2(6)
+    ->  ) ENGINE=OLAP
+    ->  DUPLICATE KEY(`k1`)
+    ->  AUTO PARTITION BY RANGE (date_trunc(`k2`, 'day'))
+    ->  (
+    ->  )
+    ->  DISTRIBUTED BY HASH(`k1`) BUCKETS 16
+    ->  PROPERTIES (
+    ->  "replication_allocation" = "tag.location.default: 1"
+    ->  );
+ERROR 1105 (HY000): errCode = 2, detailMessage = AUTO RANGE PARTITION doesn't 
support NULL column
+```
+
+
+
+## 场景示例
+
+在使用场景一节中的示例,在使用 AUTO PARTITION 后,该表 DDL 可以改写为:
+
+```sql
+CREATE TABLE `DAILY_TRADE_VALUE`
+(
+    `TRADE_DATE`              datev2 NOT NULL COMMENT '交易日期',
+    `TRADE_ID`                varchar(40) NOT NULL COMMENT '交易编号',
+    ......
+)
+UNIQUE KEY(`TRADE_DATE`, `TRADE_ID`)
+AUTO PARTITION BY RANGE (date_trunc(`TRADE_DATE`, 'year'))
+(
+)
+DISTRIBUTED BY HASH(`TRADE_DATE`) BUCKETS 10
+PROPERTIES (
+  "replication_num" = "1"
+);
+```
+
+
+
+此时新表没有默认分区:
+
+```sql
+mysql> show partitions from `DAILY_TRADE_VALUE`;
+Empty set (0.12 sec)
+```
+
+经过插入数据后再查看,发现该表已经创建了对应的分区:
+
+```sql
+mysql> insert into `DAILY_TRADE_VALUE` values ('2012-12-13', 1), 
('2008-02-03', 2), ('2014-11-11', 3);
+Query OK, 3 rows affected (0.88 sec)
+
+mysql> show partitions from `DAILY_TRADE_VALUE`;
++-------------+-----------------+----------------+---------------------+--------+--------------+--------------------------------------------------------------------------------+-----------------+---------+----------------+---------------+---------------------+---------------------+--------------------------+----------+------------+-------------------------+-----------+
+| PartitionId | PartitionName   | VisibleVersion | VisibleVersionTime  | State 
 | PartitionKey | Range                                                         
                 | DistributionKey | Buckets | ReplicationNum | StorageMedium | 
CooldownTime        | RemoteStoragePolicy | LastConsistencyCheckTime | DataSize 
| IsInMemory | ReplicaAllocation       | IsMutable |
++-------------+-----------------+----------------+---------------------+--------+--------------+--------------------------------------------------------------------------------+-----------------+---------+----------------+---------------+---------------------+---------------------+--------------------------+----------+------------+-------------------------+-----------+
+| 180060      | p20080101000000 | 2              | 2023-09-18 21:49:29 | 
NORMAL | TRADE_DATE   | [types: [DATEV2]; keys: [2008-01-01]; ..types: 
[DATEV2]; keys: [2009-01-01]; ) | TRADE_DATE      | 10      | 1              | 
HDD           | 9999-12-31 23:59:59 |                     | NULL                
     | 0.000    | false      | tag.location.default: 1 | true      |
+| 180039      | p20120101000000 | 2              | 2023-09-18 21:49:29 | 
NORMAL | TRADE_DATE   | [types: [DATEV2]; keys: [2012-01-01]; ..types: 
[DATEV2]; keys: [2013-01-01]; ) | TRADE_DATE      | 10      | 1              | 
HDD           | 9999-12-31 23:59:59 |                     | NULL                
     | 0.000    | false      | tag.location.default: 1 | true      |
+| 180018      | p20140101000000 | 2              | 2023-09-18 21:49:29 | 
NORMAL | TRADE_DATE   | [types: [DATEV2]; keys: [2014-01-01]; ..types: 
[DATEV2]; keys: [2015-01-01]; ) | TRADE_DATE      | 10      | 1              | 
HDD           | 9999-12-31 23:59:59 |                     | NULL                
     | 0.000    | false      | tag.location.default: 1 | true      |
++-------------+-----------------+----------------+---------------------+--------+--------------+--------------------------------------------------------------------------------+-----------------+---------+----------------+---------------+---------------------+---------------------+--------------------------+----------+------------+-------------------------+-----------+
+3 rows in set (0.12 sec)
+                                                                               
                   
+```
+
+经过自动分区功能所创建的 PARTITION,与手动创建的 PARTITION 具有完全一致的功能性质。
+
+## 与动态分区联用
+
+为使分区逻辑清晰,Doris 禁止自动分区(Auto Partition)和动态分区(Dynamic 
Partition)同时作用于一张表上,这种用法容易引发误用,应当以单独的自动分区功能代替。
+
+注意:在 Doris 2.1 的某些早期版本中,该功能未被禁止,但不推荐使用。
+
+## 注意事项
+
+- 如同普通分区表一样,AUTO LIST PARTITION 支持多列分区,语法并无区别。
+- 在数据的插入或导入过程中如果创建了分区,而整个导入过程没有完成(失败或被取消),被创建的分区不会被自动删除。
+- 使用 AUTO PARTITION 的表,只是分区创建方式上由手动转为了自动。表及其所创建分区的原本使用方法都与非 AUTO PARTITION 
的表或分区相同。
+- 为防止意外创建过多分区,我们通过[FE 
配置项](../admin-manual/config/fe-config)中的`max_auto_partition_num`控制了一个 AUTO 
PARTITION 表最大容纳分区数。如有需要可以调整该值

Review Comment:
   ```suggestion
   - 为防止意外创建过多分区,我们通过[FE 
配置项](../../admin-manual/config/fe-config)中的`max_auto_partition_num`控制了一个 AUTO 
PARTITION 表最大容纳分区数。如有需要可以调整该值
   ```



##########
i18n/zh-CN/docusaurus-plugin-content-docs/current/table-design/data-partitioning/auto-partitioning.md:
##########
@@ -0,0 +1,280 @@
+---
+{
+    "title": "自动分区",
+    "language": "zh-CN"
+}
+---
+
+<!-- 
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+
+## 使用场景
+
+自动分区功能主要解决了用户预期基于某列对表进行分区操作,但该列的数据分布比较零散或者难以预测,在建表或调整表结构时难以准确创建所需分区,或者分区数量过多以至于手动创建过于繁琐的问题。
+
+以时间类型分区列为例,在动态分区功能中,我们支持了按特定时间周期自动创建新分区以容纳实时数据。对于实时的用户行为日志等场景该功能基本能够满足需求。但在一些更复杂的场景下,例如处理非实时数据时,分区列与当前系统时间无关,且包含大量离散值。此时为提高效率我们希望依据此列对数据进行分区,但数据实际可能涉及的分区无法预先掌握,或者预期所需分区数量过大。这种情况下动态分区或者手动创建分区无法满足我们的需求,自动分区功能很好地覆盖了此类需求。
+
+假设我们的表 DDL 如下:
+
+```sql
+CREATE TABLE `DAILY_TRADE_VALUE`
+(
+    `TRADE_DATE`              datev2 NOT NULL COMMENT '交易日期',
+    `TRADE_ID`                varchar(40) NOT NULL COMMENT '交易编号',
+    ......
+)
+UNIQUE KEY(`TRADE_DATE`, `TRADE_ID`)
+PARTITION BY RANGE(`TRADE_DATE`)
+(
+    PARTITION p_2000 VALUES [('2000-01-01'), ('2001-01-01')),
+    PARTITION p_2001 VALUES [('2001-01-01'), ('2002-01-01')),
+    PARTITION p_2002 VALUES [('2002-01-01'), ('2003-01-01')),
+    PARTITION p_2003 VALUES [('2003-01-01'), ('2004-01-01')),
+    PARTITION p_2004 VALUES [('2004-01-01'), ('2005-01-01')),
+    PARTITION p_2005 VALUES [('2005-01-01'), ('2006-01-01')),
+    PARTITION p_2006 VALUES [('2006-01-01'), ('2007-01-01')),
+    PARTITION p_2007 VALUES [('2007-01-01'), ('2008-01-01')),
+    PARTITION p_2008 VALUES [('2008-01-01'), ('2009-01-01')),
+    PARTITION p_2009 VALUES [('2009-01-01'), ('2010-01-01')),
+    PARTITION p_2010 VALUES [('2010-01-01'), ('2011-01-01')),
+    PARTITION p_2011 VALUES [('2011-01-01'), ('2012-01-01')),
+    PARTITION p_2012 VALUES [('2012-01-01'), ('2013-01-01')),
+    PARTITION p_2013 VALUES [('2013-01-01'), ('2014-01-01')),
+    PARTITION p_2014 VALUES [('2014-01-01'), ('2015-01-01')),
+    PARTITION p_2015 VALUES [('2015-01-01'), ('2016-01-01')),
+    PARTITION p_2016 VALUES [('2016-01-01'), ('2017-01-01')),
+    PARTITION p_2017 VALUES [('2017-01-01'), ('2018-01-01')),
+    PARTITION p_2018 VALUES [('2018-01-01'), ('2019-01-01')),
+    PARTITION p_2019 VALUES [('2019-01-01'), ('2020-01-01')),
+    PARTITION p_2020 VALUES [('2020-01-01'), ('2021-01-01')),
+    PARTITION p_2021 VALUES [('2021-01-01'), ('2022-01-01'))
+)
+DISTRIBUTED BY HASH(`TRADE_DATE`) BUCKETS 10
+PROPERTIES (
+  "replication_num" = "1"
+);
+```
+
+
+
+该表内存储了大量业务历史数据,依据交易发生的日期进行分区。可以看到在建表时,我们需要预先手动创建分区。如果分区列的数据范围发生变化,例如上表中增加了 
2022 
年的数据,则我们需要通过[ALTER-TABLE-PARTITION](../sql-manual/sql-statements/Data-Definition-Statements/Alter/ALTER-TABLE-PARTITION)对表的分区进行更改。如果这种分区需要变更,或者进行更细粒度的细分,修改起来非常繁琐。此时我们就可以使用
 AUTO PARTITION 改写该表 DDL。

Review Comment:
   ```suggestion
   该表内存储了大量业务历史数据,依据交易发生的日期进行分区。可以看到在建表时,我们需要预先手动创建分区。如果分区列的数据范围发生变化,例如上表中增加了 
2022 
年的数据,则我们需要通过[ALTER-TABLE-PARTITION](../../sql-manual/sql-statements/Data-Definition-Statements/Alter/ALTER-TABLE-PARTITION)对表的分区进行更改。如果这种分区需要变更,或者进行更细粒度的细分,修改起来非常繁琐。此时我们就可以使用
 AUTO PARTITION 改写该表 DDL。
   ```



##########
i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/table-design/data-partitioning/common-issues.md:
##########
@@ -0,0 +1,64 @@
+---
+{
+    "title": "常见问题",
+    "language": "zh-CN"
+}
+---
+
+<!-- 
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+
+**1.  如果在较长的建表语句中出现语法错误,可能会出现语法错误提示不全的现象。这里罗列可能的语法错误供手动纠错:**
+
+-   语法结构错误。请仔细阅读 `HELP CREATE TABLE;`,检查相关语法结构。
+
+-   保留字。当用户自定义名称遇到保留字时,需要用反引号 `` 引起来。建议所有自定义名称使用这个符号引起来。
+
+-   中文字符或全角字符。非 utf8 编码的中文字符,或隐藏的全角字符(空格,标点等)会导致语法错误。建议使用带有显示不可见字符的文本编辑器进行检查。
+
+**2.  `Failed to create partition [xxx] . Timeout`**
+
+Doris 建表是按照 Partition 粒度依次创建的。当一个 Partition 创建失败时,可能会报这个错误。即使不使用 
Partition,当建表出现问题时,也会报 `Failed to create partition`,因为如前文所述,Doris 会为没有指定 
Partition 的表创建一个不可更改的默认的 Partition。
+
+当遇到这个错误是,通常是 BE 在创建数据分片时遇到了问题。可以参照以下步骤排查:
+
+-   在 fe.log 中,查找对应时间点的 `Failed to create partition` 日志。在该日志中,会出现一系列类似 
`{10001-10010}` 字样的数字对。数字对的第一个数字表示 Backend ID,第二个数字表示 Tablet ID。如上这个数字对,表示 ID 为 
10001 的 Backend 上,创建 ID 为 10010 的 Tablet 失败了。
+
+-   前往对应 Backend 的 be.INFO 日志,查找对应时间段内,tablet id 相关的日志,可以找到错误信息。
+
+-   以下罗列一些常见的 tablet 创建失败错误,包括但不限于:
+
+    -   BE 没有收到相关 task,此时无法在 be.INFO 中找到 tablet id 相关日志或者 BE 
创建成功,但汇报失败。以上问题,请参阅 [安装与部署](../install/cluster-deployment/standard-deployment) 
检查 FE 和 BE 的连通性。

Review Comment:
   ```suggestion
       -   BE 没有收到相关 task,此时无法在 be.INFO 中找到 tablet id 相关日志或者 BE 
创建成功,但汇报失败。以上问题,请参阅 
[安装与部署](../../install/cluster-deployment/standard-deployment) 检查 FE 和 BE 的连通性。
   ```



##########
i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/table-design/data-partitioning/manual-bucketing.md:
##########
@@ -0,0 +1,68 @@
+---
+{
+    "title": "手动分桶",
+    "language": "zh-CN"
+}
+---
+
+<!-- 
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+
+如果使用了分区,则 `DISTRIBUTED ...` 语句描述的是数据在各个分区内的划分规则。
+
+如果不使用分区,则描述的是对整个表的数据的划分规则。
+
+也可以对每个分区单独指定分桶方式。
+
+分桶列可以是多列,Aggregate 和 Unique 模型必须为 Key 列,Duplicate 模型可以是 key 列和 value 列。分桶列可以和 
Partition 列相同或不同。
+
+分桶列的选择,是在 查询吞吐 和 查询并发 之间的一种权衡:
+
+-   
如果选择多个分桶列,则数据分布更均匀。如果一个查询条件不包含所有分桶列的等值条件,那么该查询会触发所有分桶同时扫描,这样查询的吞吐会增加,单个查询的延迟随之降低。这个方式适合大吞吐低并发的查询场景。
+
+-   
如果仅选择一个或少数分桶列,则对应的点查询可以仅触发一个分桶扫描。此时,当多个点查询并发时,这些查询有较大的概率分别触发不同的分桶扫描,各个查询之间的 IO 
影响较小(尤其当不同桶分布在不同磁盘上时),所以这种方式适合高并发的点查询场景。
+
+## Bucket 的数量和数据量的建议
+
+-   一个表的 Tablet 总数量等于 (Partition num * Bucket num)。
+
+-   一个表的 Tablet 数量,在不考虑扩容的情况下,推荐略多于整个集群的磁盘数量。
+
+-   单个 Tablet 的数据量理论上没有上下界,但建议在 1G - 10G 的范围内。如果单个 Tablet 
数据量过小,则数据的聚合效果不佳,且元数据管理压力大。如果数据量过大,则不利于副本的迁移、补齐,且会增加 Schema Change 或者 Rollup 
操作失败重试的代价(这些操作失败重试的粒度是 Tablet)。
+
+-   当 Tablet 的数据量原则和数量原则冲突时,建议优先考虑数据量原则。
+
+-   在建表时,每个分区的 Bucket 数量统一指定。但是在动态增加分区时(`ADD PARTITION`),可以单独指定新分区的 Bucket 
数量。可以利用这个功能方便的应对数据缩小或膨胀。
+
+-   一个 Partition 的 Bucket 数量一旦指定,不可更改。所以在确定 Bucket 数量时,需要预先考虑集群扩容的情况。比如当前只有 3 
台 host,每台 host 有 1 块盘。如果 Bucket 的数量只设置为 3 或更小,那么后期即使再增加机器,也不能提高并发度。
+
+-   举一些例子:假设在有 10 台 BE,每台 BE 一块磁盘的情况下。如果一个表总大小为 500MB,则可以考虑 4-8 个分片。5GB:8-16 
个分片。50GB:32 个分片。500GB:建议分区,每个分区大小在 50GB 左右,每个分区 16-32 个分片。5TB:建议分区,每个分区大小在 50GB 
左右,每个分区 16-32 个分片。
+
+:::tip
+表的数据量可以通过 `SHOW DATA` 命令查看,结果除以副本数,即表的数据量。

Review Comment:
   ```suggestion
   表的数据量可以通过 `SHOW DATA` 命令查看(该命令的统计结果会有延迟),结果除以副本数,即表的数据量。
   ```



##########
i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/table-design/data-partitioning/manual-partitioning.md:
##########
@@ -0,0 +1,118 @@
+---
+{
+    "title": "手动分区",
+    "language": "zh-CN"
+}
+---
+
+<!-- 
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+
+## 分区列
+
+-   分区列可以指定一列或多列,分区列必须为 KEY 列。多列分区的使用方式在后面多列分区小结介绍。
+
+-   当 `allowPartitionColumnNullable` 为 `true` 时,Range 分区支持使用 NULL 分区列。List 
Partition 始终不支持 NULL 分区列。
+
+-   不论分区列是什么类型,在写分区值时,都需要加双引号。
+
+-   分区数量理论上没有上限。
+
+-   当不使用分区建表时,系统会自动生成一个和表名同名的,全值范围的分区。该分区对用户不可见,并且不可删改。
+
+-   创建分区时不可添加范围重叠的分区。
+
+## Range 分区
+
+分区列通常为时间列,以方便的管理新旧数据。Range 分区支持的列类型 DATE,  DATETIME, TINYINT, SMALLINT, INT, 
BIGINT, LARGEINT。
+
+**分区信息,支持四种写法:**            
+
+1.  FIXED RANGE:定义分区的左闭右开区间。  
+
+```sql
+PARTITION BY RANGE(col1[, col2, ...])                                          
                                                                                
                                                                        
+(                                                                              
                                                                                
                                                                        
+    PARTITION partition_name1 VALUES [("k1-lower1", "k2-lower1", 
"k3-lower1",...), ("k1-upper1", "k2-upper1", "k3-upper1", ...)),                
                                                                                
      
+    PARTITION partition_name2 VALUES [("k1-lower1-2", "k2-lower1-2", ...), 
("k1-upper1-2", MAXVALUE, ))                                                    
                                                                            
+)                                                                              
                                                                                
                                                                        
+```
+
+示例如下:
+
+```sql
+PARTITION BY RANGE(`date`)
+(
+    PARTITION `p201701` VALUES [("2017-01-01"),  ("2017-02-01")),
+    PARTITION `p201702` VALUES [("2017-02-01"), ("2017-03-01")),
+    PARTITION `p201703` VALUES [("2017-03-01"), ("2017-04-01"))
+)

Review Comment:
   It would be best to provide a complete example here



##########
i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/table-design/data-partitioning/common-issues.md:
##########
@@ -0,0 +1,64 @@
+---
+{
+    "title": "常见问题",
+    "language": "zh-CN"
+}
+---
+
+<!-- 
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+
+**1.  如果在较长的建表语句中出现语法错误,可能会出现语法错误提示不全的现象。这里罗列可能的语法错误供手动纠错:**
+
+-   语法结构错误。请仔细阅读 `HELP CREATE TABLE;`,检查相关语法结构。
+
+-   保留字。当用户自定义名称遇到保留字时,需要用反引号 `` 引起来。建议所有自定义名称使用这个符号引起来。
+
+-   中文字符或全角字符。非 utf8 编码的中文字符,或隐藏的全角字符(空格,标点等)会导致语法错误。建议使用带有显示不可见字符的文本编辑器进行检查。
+
+**2.  `Failed to create partition [xxx] . Timeout`**
+
+Doris 建表是按照 Partition 粒度依次创建的。当一个 Partition 创建失败时,可能会报这个错误。即使不使用 
Partition,当建表出现问题时,也会报 `Failed to create partition`,因为如前文所述,Doris 会为没有指定 
Partition 的表创建一个不可更改的默认的 Partition。
+
+当遇到这个错误是,通常是 BE 在创建数据分片时遇到了问题。可以参照以下步骤排查:
+
+-   在 fe.log 中,查找对应时间点的 `Failed to create partition` 日志。在该日志中,会出现一系列类似 
`{10001-10010}` 字样的数字对。数字对的第一个数字表示 Backend ID,第二个数字表示 Tablet ID。如上这个数字对,表示 ID 为 
10001 的 Backend 上,创建 ID 为 10010 的 Tablet 失败了。
+
+-   前往对应 Backend 的 be.INFO 日志,查找对应时间段内,tablet id 相关的日志,可以找到错误信息。
+
+-   以下罗列一些常见的 tablet 创建失败错误,包括但不限于:
+
+    -   BE 没有收到相关 task,此时无法在 be.INFO 中找到 tablet id 相关日志或者 BE 
创建成功,但汇报失败。以上问题,请参阅 [安装与部署](../install/cluster-deployment/standard-deployment) 
检查 FE 和 BE 的连通性。
+
+    -   预分配内存失败。可能是表中一行的字节长度超过了 100KB。
+
+    -   `Too many open files`。打开的文件句柄数超过了 Linux 系统限制。需修改 Linux 系统的句柄数限制。
+
+如果创建数据分片时超时,也可以通过在 fe.conf 中设置 `tablet_create_timeout_second=xxx` 以及 
`max_create_table_timeout_second=xxx` 来延长超时时间。其中 `tablet_create_timeout_second` 
默认是 1 秒,`max_create_table_timeout_second` 默认是 60 秒,总体的超时时间为 
min(tablet_create_timeout_second * replication_num, 
max_create_table_timeout_second),具体参数设置可参阅 [FE 
配置项](../admin-manual/config/fe-config) 。
+
+**3.  建表命令长时间不返回结果。**
+
+-   Doris 的建表命令是同步命令。该命令的超时时间目前设置的比较简单,即(tablet num * replication 
num)秒。如果创建较多的数据分片,并且其中有分片创建失败,则可能导致等待较长超时后,才会返回错误。
+
+-   正常情况下,建表语句会在几秒或十几秒内返回。如果超过一分钟,建议直接取消掉这个操作,前往 FE 或 BE 的日志查看相关错误。
+
+## 更多帮助
+
+关于数据划分更多的详细说明,我们可以在 [CREATE 
TABLE](../sql-manual/sql-reference/Data-Definition-Statements/Create/CREATE-TABLE)
 命令手册中查阅,也可以在 MySQL 客户端下输入 `HELP CREATE TABLE;` 获取更多的帮助信息。

Review Comment:
   ```suggestion
   关于数据划分更多的详细说明,我们可以在 [CREATE 
TABLE](../../sql-manual/sql-reference/Data-Definition-Statements/Create/CREATE-TABLE)
 命令手册中查阅,也可以在 MySQL 客户端下输入 `HELP CREATE TABLE;` 获取更多的帮助信息。
   ```



##########
i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/table-design/data-partitioning/manual-partitioning.md:
##########
@@ -0,0 +1,118 @@
+---
+{
+    "title": "手动分区",
+    "language": "zh-CN"
+}
+---
+
+<!-- 
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+
+## 分区列
+
+-   分区列可以指定一列或多列,分区列必须为 KEY 列。多列分区的使用方式在后面多列分区小结介绍。
+
+-   当 `allowPartitionColumnNullable` 为 `true` 时,Range 分区支持使用 NULL 分区列。List 
Partition 始终不支持 NULL 分区列。
+
+-   不论分区列是什么类型,在写分区值时,都需要加双引号。
+
+-   分区数量理论上没有上限。

Review Comment:
   ```suggestion
   -   分区数量理论上没有上限。但默认限制每张表 4096 个分区,如果想突破这个限制,可以修改 FE 
配置`max_multi_partition_num`和`max_dynamic_partition_num `。
   ```



##########
i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/table-design/data-partitioning/common-issues.md:
##########
@@ -0,0 +1,64 @@
+---
+{
+    "title": "常见问题",
+    "language": "zh-CN"
+}
+---
+
+<!-- 
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+
+**1.  如果在较长的建表语句中出现语法错误,可能会出现语法错误提示不全的现象。这里罗列可能的语法错误供手动纠错:**
+
+-   语法结构错误。请仔细阅读 `HELP CREATE TABLE;`,检查相关语法结构。
+
+-   保留字。当用户自定义名称遇到保留字时,需要用反引号 `` 引起来。建议所有自定义名称使用这个符号引起来。
+
+-   中文字符或全角字符。非 utf8 编码的中文字符,或隐藏的全角字符(空格,标点等)会导致语法错误。建议使用带有显示不可见字符的文本编辑器进行检查。
+
+**2.  `Failed to create partition [xxx] . Timeout`**
+
+Doris 建表是按照 Partition 粒度依次创建的。当一个 Partition 创建失败时,可能会报这个错误。即使不使用 
Partition,当建表出现问题时,也会报 `Failed to create partition`,因为如前文所述,Doris 会为没有指定 
Partition 的表创建一个不可更改的默认的 Partition。
+
+当遇到这个错误是,通常是 BE 在创建数据分片时遇到了问题。可以参照以下步骤排查:
+
+-   在 fe.log 中,查找对应时间点的 `Failed to create partition` 日志。在该日志中,会出现一系列类似 
`{10001-10010}` 字样的数字对。数字对的第一个数字表示 Backend ID,第二个数字表示 Tablet ID。如上这个数字对,表示 ID 为 
10001 的 Backend 上,创建 ID 为 10010 的 Tablet 失败了。
+
+-   前往对应 Backend 的 be.INFO 日志,查找对应时间段内,tablet id 相关的日志,可以找到错误信息。
+
+-   以下罗列一些常见的 tablet 创建失败错误,包括但不限于:
+
+    -   BE 没有收到相关 task,此时无法在 be.INFO 中找到 tablet id 相关日志或者 BE 
创建成功,但汇报失败。以上问题,请参阅 [安装与部署](../install/cluster-deployment/standard-deployment) 
检查 FE 和 BE 的连通性。
+
+    -   预分配内存失败。可能是表中一行的字节长度超过了 100KB。
+
+    -   `Too many open files`。打开的文件句柄数超过了 Linux 系统限制。需修改 Linux 系统的句柄数限制。
+
+如果创建数据分片时超时,也可以通过在 fe.conf 中设置 `tablet_create_timeout_second=xxx` 以及 
`max_create_table_timeout_second=xxx` 来延长超时时间。其中 `tablet_create_timeout_second` 
默认是 1 秒,`max_create_table_timeout_second` 默认是 60 秒,总体的超时时间为 
min(tablet_create_timeout_second * replication_num, 
max_create_table_timeout_second),具体参数设置可参阅 [FE 
配置项](../admin-manual/config/fe-config) 。

Review Comment:
   ```suggestion
   如果创建数据分片时超时,也可以通过在 fe.conf 中设置 `tablet_create_timeout_second=xxx` 以及 
`max_create_table_timeout_second=xxx` 来延长超时时间。其中 `tablet_create_timeout_second` 
默认是 1 秒,`max_create_table_timeout_second` 默认是 60 秒,总体的超时时间为 
min(tablet_create_timeout_second * replication_num, 
max_create_table_timeout_second),具体参数设置可参阅 [FE 
配置项](../../admin-manual/config/fe-config) 。
   ```



##########
i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/table-design/data-partitioning/basic-concepts.md:
##########
@@ -0,0 +1,186 @@
+---
+{
+    "title": "基本概念",
+    "language": "zh-CN"
+}
+---
+
+<!-- 
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+
+本文档主要介绍 Doris 的建表和数据划分,以及建表操作中可能遇到的问题和解决方法。
+
+
+## Row & Column
+
+在 Doris 中,数据都以表(Table)的形式进行逻辑上的描述。
+
+一张表包括行(Row)和列(Column):
+
+-   Row:即用户的一行数据;
+
+-   Column:用于描述一行数据中不同的字段;
+
+-   Column 可以分为两大类:Key 和 Value。从业务角度看,Key 和 Value 可以分别对应维度列和指标列。Doris 的 key 
列是建表语句中指定的列,建表语句中的关键字'unique key'或'aggregate key'或'duplicate key'后面的列就是 key 
列,除了 key 列剩下的就是 value 列。从聚合模型的角度来说,Key 列相同的行,会聚合成一行。其中 Value 
列的聚合方式由用户在建表时指定。关于更多聚合模型的介绍,可以参阅 [Doris 
数据模型](../table-design/data-model/overview)。
+
+## 分区和分桶(Partition & Bucket) 
+
+Doris 使用分区和分桶的两层划分方式来组织和管理数据。
+
+### 分区
+
+分区是指根据表中特定列的值进行分段,将表中的数据划分为更小,更易于管理的不相交的子集,每一个数据子集称为一个分区。每一行数据属于且只属于一个特定的分区。分区可以视为最小的逻辑管理单元。
+
+目前 Doris 支持 Range 和 List 的分区划分方式。建表时如果不指定分区,此时 Doris 
会生成一个默认的分区包含表中的所有数据,这个分区对用户是透明的。
+
+合理地根据数据分布特征和查询模式进行分区有许多好处:
+
+- 
查询性能提升:通过分区,系统可以根据查询的条件裁剪不相关的分区,减少了数据扫描量,显著提高了查询效率。特别是在处理大规模数据集时,分区策略能大幅度降低I/O负担。
+
+- 
管理灵活性:分区使得数据可以按时间、地域等逻辑进行分割,方便数据的归档、清理和备份。例如,按时间分区可以有效地管理历史数据和新增数据,支持基于时间的高效数据维护策略。
+
+### 分桶
+
+分桶是指将一个分区中的数据进一步按照某种规则被划分更小的不相交的数据单元。每一行数据属于且只属于一个特定的分桶。与根据特定列值对数据进行分段的分区不同,分桶尝试将数据均匀分布在预定义的桶中,从而减少数据倾斜的问题。分桶通过确保数据分布均匀并提高数据局部性以提升查询执行的性能。
+
+目前 Doris 支持 Hash 和 Random 的分桶划分方式。
+
+一个分桶在物理上对应一个数据分片(Tablet),数据分片在物理上是独立存储的,它是数据移动、复制等操作的最小物理存储单元。
+
+合理地分桶能够带来许多收益:
+
+- 均匀数据分布:分桶可以将数据均匀地分布在各个桶中,减少了数据集中或倾斜的风险,从而避免了部分节点或存储设备的资源过载问题。
+
+- 减少热点:通过均匀分布数据,分桶有助于减少某些特定节点或分区过度负载的现象,避免热点问题,提升系统的稳定性和处理能力。
+
+- 
提高并发性能:分桶帮助提高并发查询的性能,特别是当多个查询请求需要访问相同分区中的不同数据时,分桶的粒度使得系统能够有效地并行处理多个请求,从而提升吞吐量。
+
+## 建表举例
+
+Doris 的建表是一个同步命令,SQL 执行完成即返回结果,命令返回成功即表示建表成功。具体建表语法可以参考[CREATE 
TABLE](../../sql-manual/sql-reference/Data-Definition-Statements/Create/CREATE-TABLE),也可以通过
 `HELP CREATE TABLE` 查看更多帮助。
+
+这里给出了一个采用了 Range 分区 和 Hash 分桶的建表举例。
+
+```sql
+-- Range Partition
+CREATE TABLE IF NOT EXISTS example_range_tbl
+(
+    `user_id` LARGEINT NOT NULL COMMENT "用户id",
+    `date` DATE NOT NULL COMMENT "数据灌入日期时间",
+    `timestamp` DATETIME NOT NULL COMMENT "数据灌入的时间戳",
+    `city` VARCHAR(20) COMMENT "用户所在城市",
+    `age` SMALLINT COMMENT "用户年龄",
+    `sex` TINYINT COMMENT "用户性别",
+    `last_visit_date` DATETIME REPLACE DEFAULT "1970-01-01 00:00:00" COMMENT 
"用户最后一次访问时间",
+    `cost` BIGINT SUM DEFAULT "0" COMMENT "用户总消费",
+    `max_dwell_time` INT MAX DEFAULT "0" COMMENT "用户最大停留时间",
+    `min_dwell_time` INT MIN DEFAULT "99999" COMMENT "用户最小停留时间"
+)
+ENGINE=OLAP
+AGGREGATE KEY(`user_id`, `date`, `timestamp`, `city`, `age`, `sex`)
+PARTITION BY RANGE(`date`)
+(
+    PARTITION `p201701` VALUES [("2017-01-01"),  ("2017-02-01")),
+    PARTITION `p201702` VALUES [("2017-02-01"), ("2017-03-01")),
+    PARTITION `p201703` VALUES [("2017-03-01"), ("2017-04-01"))
+)
+DISTRIBUTED BY HASH(`user_id`) BUCKETS 16
+PROPERTIES
+(
+    "replication_num" = "1"
+);
+```
+
+这里以 AGGREGATE KEY 数据模型为例进行说明。AGGREGATE KEY 
数据模型中,所有没有指定聚合方式(SUM、REPLACE、MAX、MIN)的列视为 Key 列。而其余则为 Value 列。
+
+在建表语句的最后 PROPERTIES 中,关于 PROPERTIES 中可以设置的相关参数,可以查看[CREATE 
TABLE](../../sql-manual/sql-reference/Data-Definition-Statements/Create/CREATE-TABLE)中的详细介绍。
+
+ENGINE 的类型是 OLAP,即默认的 ENGINE 类型。在 Doris 中,只有这个 ENGINE 类型是由 Doris 负责数据管理和存储的。其他 
ENGINE 类型,如 MySQL、 Broker、ES 等等,本质上只是对外部其他数据库或系统中的表的映射,以保证 Doris 可以读取这些数据。而 
Doris 本身并不创建、管理和存储任何非 OLAP ENGINE 类型的表和数据。
+
+`IF NOT EXISTS`表示如果没有创建过该表,则创建。注意这里只判断表名是否存在,而不会判断新建表 Schema 是否与已存在的表 Schema 
相同。所以如果存在一个同名但不同 Schema 的表,该命令也会返回成功,但并不代表已经创建了新的表和新的 Schema。。
+
+## 查看分区信息
+
+可以通过 show create table 来查看表的分区信息。
+
+```sql
+> show create table  example_range_tbl 
++-------------------+---------------------------------------------------------------------------------------------------------+
                                                                                
                            
+| Table             | Create Table                                             
                                               |                                
                                                                            
++-------------------+---------------------------------------------------------------------------------------------------------+
                                                                                
                            
+| example_range_tbl | CREATE TABLE `example_range_tbl` (                       
                                               |                                
                                                                            
+|                   |   `user_id` largeint(40) NOT NULL COMMENT '用户id',        
                                             |                                  
                                                                          
+|                   |   `date` date NOT NULL COMMENT '数据灌入日期时间',               
                                       |                                        
                                                                    
+|                   |   `timestamp` datetime NOT NULL COMMENT '数据灌入的时间戳',      
                                       |                                        
                                                                    
+|                   |   `city` varchar(20) NULL COMMENT '用户所在城市',              
                                         |                                      
                                                                      
+|                   |   `age` smallint(6) NULL COMMENT '用户年龄',                 
                                           |                                    
                                                                        
+|                   |   `sex` tinyint(4) NULL COMMENT '用户性别',                  
                                           |                                    
                                                                        
+|                   |   `last_visit_date` datetime REPLACE NULL DEFAULT 
"1970-01-01 00:00:00" COMMENT '用户最后一次访问时间', |                                   
                                                                         
+|                   |   `cost` bigint(20) SUM NULL DEFAULT "0" COMMENT 
'用户总消费',                                          |                             
                                                                               
+|                   |   `max_dwell_time` int(11) MAX NULL DEFAULT "0" COMMENT 
'用户最大停留时间',                             |                                       
                                                                     
+|                   |   `min_dwell_time` int(11) MIN NULL DEFAULT "99999" 
COMMENT '用户最小停留时间'                          |                                   
                                                                         
+|                   | ) ENGINE=OLAP                                            
                                               |                                
                                                                            
+|                   | AGGREGATE KEY(`user_id`, `date`, `timestamp`, `city`, 
`age`, `sex`)                                     |                             
                                                                               
+|                   | COMMENT 'OLAP'                                           
                                               |                                
                                                                            
+|                   | PARTITION BY RANGE(`date`)                               
                                               |                                
                                                                            
+|                   | (PARTITION p201701 VALUES [('0000-01-01'), 
('2017-02-01')),                                             |                  
                                                                                
          
+|                   | PARTITION p201702 VALUES [('2017-02-01'), 
('2017-03-01')),                                              |                 
                                                                                
           
+|                   | PARTITION p201703 VALUES [('2017-03-01'), 
('2017-04-01')))                                              |                 
                                                                                
           
+|                   | DISTRIBUTED BY HASH(`user_id`) BUCKETS 16                
                                               |                                
                                                                            
+|                   | PROPERTIES (                                             
                                               |                                
                                                                            
+|                   | "replication_allocation" = "tag.location.default: 1",    
                                               |                                
                                                                            
+|                   | "is_being_synced" = "false",                             
                                               |                                
                                                                            
+|                   | "storage_format" = "V2",                                 
                                               |                                
                                                                            
+|                   | "light_schema_change" = "true",                          
                                               |                                
                                                                            
+|                   | "disable_auto_compaction" = "false",                     
                                               |                                
                                                                            
+|                   | "enable_single_replica_compaction" = "false"             
                                               |                                
                                                                            
+|                   | );                                                       
                                               |                                
                                                                            
++-------------------+---------------------------------------------------------------------------------------------------------+
   
+```
+
+可以通过 show partitions from your_table 来查看表的分区信息。
+
+```sql
+> show partitions from example_range_tbl
++-------------+---------------+----------------+---------------------+--------+--------------+--------------------------------------------------------------------------------+-----------------+---------+----------------+---------------
++---------------------+---------------------+--------------------------+----------+------------+-------------------------+-----------+
                                                                                
                     
+| PartitionId | PartitionName | VisibleVersion | VisibleVersionTime  | State  
| PartitionKey | Range                                                          
                | DistributionKey | Buckets | ReplicationNum | StorageMedium 
+| CooldownTime        | RemoteStoragePolicy | LastConsistencyCheckTime | 
DataSize | IsInMemory | ReplicaAllocation       | IsMutable |                   
                                                                                
  
++-------------+---------------+----------------+---------------------+--------+--------------+--------------------------------------------------------------------------------+-----------------+---------+----------------+---------------
++---------------------+---------------------+--------------------------+----------+------------+-------------------------+-----------+
                                                                                
                     
+| 28731       | p201701       | 1              | 2024-01-25 10:50:51 | NORMAL 
| date         | [types: [DATEV2]; keys: [0000-01-01]; ..types: [DATEV2]; keys: 
[2017-02-01]; ) | user_id         | 16      | 1              | HDD           
+| 9999-12-31 23:59:59 |                     |                    | 0.000    | 
false      | tag.location.default: 1 | true      |                              
                                                                       
+| 28732       | p201702       | 1              | 2024-01-25 10:50:51 | NORMAL 
| date         | [types: [DATEV2]; keys: [2017-02-01]; ..types: [DATEV2]; keys: 
[2017-03-01]; ) | user_id         | 16      | 1              | HDD           
+| 9999-12-31 23:59:59 |                     |                    | 0.000    | 
false      | tag.location.default: 1 | true      |                              
                                                                       
+| 28733       | p201703       | 1              | 2024-01-25 10:50:51 | NORMAL 
| date         | [types: [DATEV2]; keys: [2017-03-01]; ..types: [DATEV2]; keys: 
[2017-04-01]; ) | user_id         | 16      | 1              | HDD           
+| 9999-12-31 23:59:59 |                     |                    | 0.000    | 
false      | tag.location.default: 1 | true      |                              
                                                                       
++-------------+---------------+----------------+---------------------+--------+--------------+--------------------------------------------------------------------------------+-----------------+---------+----------------+---------------
++---------------------+---------------------+--------------------------+----------+------------+-------------------------+-----------+
                  
+```
+
+## 修改分区信息
+
+通过 alter table add partition 来增加新的分区
+
+```Plain

Review Comment:
   ```suggestion
   ```sql
   ```



##########
i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/table-design/data-partitioning/basic-concepts.md:
##########
@@ -0,0 +1,186 @@
+---
+{
+    "title": "基本概念",
+    "language": "zh-CN"
+}
+---
+
+<!-- 
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+
+本文档主要介绍 Doris 的建表和数据划分,以及建表操作中可能遇到的问题和解决方法。
+
+
+## Row & Column
+
+在 Doris 中,数据都以表(Table)的形式进行逻辑上的描述。
+
+一张表包括行(Row)和列(Column):
+
+-   Row:即用户的一行数据;
+
+-   Column:用于描述一行数据中不同的字段;
+
+-   Column 可以分为两大类:Key 和 Value。从业务角度看,Key 和 Value 可以分别对应维度列和指标列。Doris 的 key 
列是建表语句中指定的列,建表语句中的关键字'unique key'或'aggregate key'或'duplicate key'后面的列就是 key 
列,除了 key 列剩下的就是 value 列。从聚合模型的角度来说,Key 列相同的行,会聚合成一行。其中 Value 
列的聚合方式由用户在建表时指定。关于更多聚合模型的介绍,可以参阅 [Doris 
数据模型](../table-design/data-model/overview)。
+
+## 分区和分桶(Partition & Bucket) 
+
+Doris 使用分区和分桶的两层划分方式来组织和管理数据。
+
+### 分区
+
+分区是指根据表中特定列的值进行分段,将表中的数据划分为更小,更易于管理的不相交的子集,每一个数据子集称为一个分区。每一行数据属于且只属于一个特定的分区。分区可以视为最小的逻辑管理单元。
+
+目前 Doris 支持 Range 和 List 的分区划分方式。建表时如果不指定分区,此时 Doris 
会生成一个默认的分区包含表中的所有数据,这个分区对用户是透明的。
+
+合理地根据数据分布特征和查询模式进行分区有许多好处:
+
+- 
查询性能提升:通过分区,系统可以根据查询的条件裁剪不相关的分区,减少了数据扫描量,显著提高了查询效率。特别是在处理大规模数据集时,分区策略能大幅度降低I/O负担。
+
+- 
管理灵活性:分区使得数据可以按时间、地域等逻辑进行分割,方便数据的归档、清理和备份。例如,按时间分区可以有效地管理历史数据和新增数据,支持基于时间的高效数据维护策略。
+
+### 分桶
+
+分桶是指将一个分区中的数据进一步按照某种规则被划分更小的不相交的数据单元。每一行数据属于且只属于一个特定的分桶。与根据特定列值对数据进行分段的分区不同,分桶尝试将数据均匀分布在预定义的桶中,从而减少数据倾斜的问题。分桶通过确保数据分布均匀并提高数据局部性以提升查询执行的性能。
+
+目前 Doris 支持 Hash 和 Random 的分桶划分方式。
+
+一个分桶在物理上对应一个数据分片(Tablet),数据分片在物理上是独立存储的,它是数据移动、复制等操作的最小物理存储单元。
+
+合理地分桶能够带来许多收益:
+
+- 均匀数据分布:分桶可以将数据均匀地分布在各个桶中,减少了数据集中或倾斜的风险,从而避免了部分节点或存储设备的资源过载问题。
+
+- 减少热点:通过均匀分布数据,分桶有助于减少某些特定节点或分区过度负载的现象,避免热点问题,提升系统的稳定性和处理能力。
+
+- 
提高并发性能:分桶帮助提高并发查询的性能,特别是当多个查询请求需要访问相同分区中的不同数据时,分桶的粒度使得系统能够有效地并行处理多个请求,从而提升吞吐量。
+
+## 建表举例
+
+Doris 的建表是一个同步命令,SQL 执行完成即返回结果,命令返回成功即表示建表成功。具体建表语法可以参考[CREATE 
TABLE](../../sql-manual/sql-reference/Data-Definition-Statements/Create/CREATE-TABLE),也可以通过
 `HELP CREATE TABLE` 查看更多帮助。
+
+这里给出了一个采用了 Range 分区 和 Hash 分桶的建表举例。
+
+```sql
+-- Range Partition
+CREATE TABLE IF NOT EXISTS example_range_tbl
+(
+    `user_id` LARGEINT NOT NULL COMMENT "用户id",
+    `date` DATE NOT NULL COMMENT "数据灌入日期时间",
+    `timestamp` DATETIME NOT NULL COMMENT "数据灌入的时间戳",
+    `city` VARCHAR(20) COMMENT "用户所在城市",
+    `age` SMALLINT COMMENT "用户年龄",
+    `sex` TINYINT COMMENT "用户性别",
+    `last_visit_date` DATETIME REPLACE DEFAULT "1970-01-01 00:00:00" COMMENT 
"用户最后一次访问时间",
+    `cost` BIGINT SUM DEFAULT "0" COMMENT "用户总消费",
+    `max_dwell_time` INT MAX DEFAULT "0" COMMENT "用户最大停留时间",
+    `min_dwell_time` INT MIN DEFAULT "99999" COMMENT "用户最小停留时间"
+)
+ENGINE=OLAP
+AGGREGATE KEY(`user_id`, `date`, `timestamp`, `city`, `age`, `sex`)
+PARTITION BY RANGE(`date`)
+(
+    PARTITION `p201701` VALUES [("2017-01-01"),  ("2017-02-01")),
+    PARTITION `p201702` VALUES [("2017-02-01"), ("2017-03-01")),
+    PARTITION `p201703` VALUES [("2017-03-01"), ("2017-04-01"))
+)
+DISTRIBUTED BY HASH(`user_id`) BUCKETS 16
+PROPERTIES
+(
+    "replication_num" = "1"
+);
+```
+
+这里以 AGGREGATE KEY 数据模型为例进行说明。AGGREGATE KEY 
数据模型中,所有没有指定聚合方式(SUM、REPLACE、MAX、MIN)的列视为 Key 列。而其余则为 Value 列。
+
+在建表语句的最后 PROPERTIES 中,关于 PROPERTIES 中可以设置的相关参数,可以查看[CREATE 
TABLE](../../sql-manual/sql-reference/Data-Definition-Statements/Create/CREATE-TABLE)中的详细介绍。
+
+ENGINE 的类型是 OLAP,即默认的 ENGINE 类型。在 Doris 中,只有这个 ENGINE 类型是由 Doris 负责数据管理和存储的。其他 
ENGINE 类型,如 MySQL、 Broker、ES 等等,本质上只是对外部其他数据库或系统中的表的映射,以保证 Doris 可以读取这些数据。而 
Doris 本身并不创建、管理和存储任何非 OLAP ENGINE 类型的表和数据。
+
+`IF NOT EXISTS`表示如果没有创建过该表,则创建。注意这里只判断表名是否存在,而不会判断新建表 Schema 是否与已存在的表 Schema 
相同。所以如果存在一个同名但不同 Schema 的表,该命令也会返回成功,但并不代表已经创建了新的表和新的 Schema。。
+
+## 查看分区信息
+
+可以通过 show create table 来查看表的分区信息。
+
+```sql
+> show create table  example_range_tbl 
++-------------------+---------------------------------------------------------------------------------------------------------+
                                                                                
                            
+| Table             | Create Table                                             
                                               |                                
                                                                            
++-------------------+---------------------------------------------------------------------------------------------------------+
                                                                                
                            
+| example_range_tbl | CREATE TABLE `example_range_tbl` (                       
                                               |                                
                                                                            
+|                   |   `user_id` largeint(40) NOT NULL COMMENT '用户id',        
                                             |                                  
                                                                          
+|                   |   `date` date NOT NULL COMMENT '数据灌入日期时间',               
                                       |                                        
                                                                    
+|                   |   `timestamp` datetime NOT NULL COMMENT '数据灌入的时间戳',      
                                       |                                        
                                                                    
+|                   |   `city` varchar(20) NULL COMMENT '用户所在城市',              
                                         |                                      
                                                                      
+|                   |   `age` smallint(6) NULL COMMENT '用户年龄',                 
                                           |                                    
                                                                        
+|                   |   `sex` tinyint(4) NULL COMMENT '用户性别',                  
                                           |                                    
                                                                        
+|                   |   `last_visit_date` datetime REPLACE NULL DEFAULT 
"1970-01-01 00:00:00" COMMENT '用户最后一次访问时间', |                                   
                                                                         
+|                   |   `cost` bigint(20) SUM NULL DEFAULT "0" COMMENT 
'用户总消费',                                          |                             
                                                                               
+|                   |   `max_dwell_time` int(11) MAX NULL DEFAULT "0" COMMENT 
'用户最大停留时间',                             |                                       
                                                                     
+|                   |   `min_dwell_time` int(11) MIN NULL DEFAULT "99999" 
COMMENT '用户最小停留时间'                          |                                   
                                                                         
+|                   | ) ENGINE=OLAP                                            
                                               |                                
                                                                            
+|                   | AGGREGATE KEY(`user_id`, `date`, `timestamp`, `city`, 
`age`, `sex`)                                     |                             
                                                                               
+|                   | COMMENT 'OLAP'                                           
                                               |                                
                                                                            
+|                   | PARTITION BY RANGE(`date`)                               
                                               |                                
                                                                            
+|                   | (PARTITION p201701 VALUES [('0000-01-01'), 
('2017-02-01')),                                             |                  
                                                                                
          
+|                   | PARTITION p201702 VALUES [('2017-02-01'), 
('2017-03-01')),                                              |                 
                                                                                
           
+|                   | PARTITION p201703 VALUES [('2017-03-01'), 
('2017-04-01')))                                              |                 
                                                                                
           
+|                   | DISTRIBUTED BY HASH(`user_id`) BUCKETS 16                
                                               |                                
                                                                            
+|                   | PROPERTIES (                                             
                                               |                                
                                                                            
+|                   | "replication_allocation" = "tag.location.default: 1",    
                                               |                                
                                                                            
+|                   | "is_being_synced" = "false",                             
                                               |                                
                                                                            
+|                   | "storage_format" = "V2",                                 
                                               |                                
                                                                            
+|                   | "light_schema_change" = "true",                          
                                               |                                
                                                                            
+|                   | "disable_auto_compaction" = "false",                     
                                               |                                
                                                                            
+|                   | "enable_single_replica_compaction" = "false"             
                                               |                                
                                                                            
+|                   | );                                                       
                                               |                                
                                                                            
++-------------------+---------------------------------------------------------------------------------------------------------+
   
+```
+
+可以通过 show partitions from your_table 来查看表的分区信息。
+
+```sql
+> show partitions from example_range_tbl
++-------------+---------------+----------------+---------------------+--------+--------------+--------------------------------------------------------------------------------+-----------------+---------+----------------+---------------
++---------------------+---------------------+--------------------------+----------+------------+-------------------------+-----------+
                                                                                
                     
+| PartitionId | PartitionName | VisibleVersion | VisibleVersionTime  | State  
| PartitionKey | Range                                                          
                | DistributionKey | Buckets | ReplicationNum | StorageMedium 
+| CooldownTime        | RemoteStoragePolicy | LastConsistencyCheckTime | 
DataSize | IsInMemory | ReplicaAllocation       | IsMutable |                   
                                                                                
  
++-------------+---------------+----------------+---------------------+--------+--------------+--------------------------------------------------------------------------------+-----------------+---------+----------------+---------------
++---------------------+---------------------+--------------------------+----------+------------+-------------------------+-----------+
                                                                                
                     
+| 28731       | p201701       | 1              | 2024-01-25 10:50:51 | NORMAL 
| date         | [types: [DATEV2]; keys: [0000-01-01]; ..types: [DATEV2]; keys: 
[2017-02-01]; ) | user_id         | 16      | 1              | HDD           
+| 9999-12-31 23:59:59 |                     |                    | 0.000    | 
false      | tag.location.default: 1 | true      |                              
                                                                       
+| 28732       | p201702       | 1              | 2024-01-25 10:50:51 | NORMAL 
| date         | [types: [DATEV2]; keys: [2017-02-01]; ..types: [DATEV2]; keys: 
[2017-03-01]; ) | user_id         | 16      | 1              | HDD           
+| 9999-12-31 23:59:59 |                     |                    | 0.000    | 
false      | tag.location.default: 1 | true      |                              
                                                                       
+| 28733       | p201703       | 1              | 2024-01-25 10:50:51 | NORMAL 
| date         | [types: [DATEV2]; keys: [2017-03-01]; ..types: [DATEV2]; keys: 
[2017-04-01]; ) | user_id         | 16      | 1              | HDD           
+| 9999-12-31 23:59:59 |                     |                    | 0.000    | 
false      | tag.location.default: 1 | true      |                              
                                                                       
++-------------+---------------+----------------+---------------------+--------+--------------+--------------------------------------------------------------------------------+-----------------+---------+----------------+---------------
++---------------------+---------------------+--------------------------+----------+------------+-------------------------+-----------+
                  
+```
+
+## 修改分区信息
+
+通过 alter table add partition 来增加新的分区
+
+```Plain
+ALTER TABLE example_range_tbl ADD  PARTITION p201704 VALUES LESS 
THAN("2020-05-01") DISTRIBUTED BY HASH(`user_id`) BUCKETS 5;
+```
+
+其它更多分区修改操作,参见 SQL 手册 
[ALTER-TABLE-PARTITION](../../sql-manual/sql-statements/Data-Definition-Statements/Alter/ALTER-TABLE-PARTITION)。

Review Comment:
   ```suggestion
   其它更多分区修改操作,参见 SQL 手册 
[ALTER-TABLE-PARTITION](../../sql-manual/sql-reference/Data-Definition-Statements/Alter/ALTER-TABLE-PARTITION)。
   ```



##########
i18n/zh-CN/docusaurus-plugin-content-docs/version-2.0/table-design/data-partitioning/dynamic-partitioning.md:
##########
@@ -0,0 +1,464 @@
+---
+{
+    "title": "动态分区",
+    "language": "zh-CN"
+}
+---
+
+<!-- 
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+
+动态分区旨在对表级别的分区实现生命周期管理 (TTL),减少用户的使用负担。
+
+在某些使用场景下,用户会将表按照天进行分区划分,每天定时执行例行任务,这时需要使用方手动管理分区,否则可能由于使用方没有创建分区导致数据导入失败,这给使用方带来了额外的维护成本。
+
+通过动态分区功能,用户可以在建表时设定动态分区的规则。FE 会启动一个后台线程,根据用户指定的规则创建或删除分区。用户也可以在运行时对现有规则进行变更。
+
+动态分区只支持 Range 分区。目前实现了动态添加分区及动态删除分区的功能。
+
+:::caution
+注意:动态分区功能在被 CCR 同步时将会失效。
+
+如果这个表是被 CCR 复制而来的,即 PROPERTIES 中包含`is_being_synced = true`时,在`show create 
table`中会显示开启状态,但不会实际生效。当`is_being_synced`被设置为 `false` 
时,这些功能将会恢复生效,但`is_being_synced`属性仅供 CCR 外围模块使用,在 CCR 同步的过程中不要手动设置。
+:::
+
+## 使用方式
+
+动态分区的规则可以在建表时指定,或者在运行时进行修改。当前仅支持对单分区列的分区表设定动态分区规则。
+
+- 建表时指定
+
+  ```sql
+  CREATE TABLE tbl1
+  (...)
+  PROPERTIES
+  (
+      "dynamic_partition.prop1" = "value1",
+      "dynamic_partition.prop2" = "value2",
+      ...
+  )
+  ```
+
+- 运行时修改
+
+  ```sql
+  ALTER TABLE tbl1 SET
+  (
+      "dynamic_partition.prop1" = "value1",
+      "dynamic_partition.prop2" = "value2",
+      ...
+  )
+  ```
+
+## 规则参数
+
+动态分区的规则参数都以 `dynamic_partition.` 为前缀:
+
+- `dynamic_partition.enable`
+
+  是否开启动态分区特性。可指定为 `TRUE` 或 `FALSE`。如果不填写,默认为 `TRUE`。如果为 `FALSE`,则 Doris 
会忽略该表的动态分区规则。
+
+- `dynamic_partition.time_unit`**(必选参数)**
+
+  动态分区调度的单位。可指定为 
`HOUR`、`DAY`、`WEEK`、`MONTH`、`YEAR`。分别表示按小时、按天、按星期、按月、按年进行分区创建或删除。
+
+  当指定为 `HOUR` 时,动态创建的分区名后缀格式为 `yyyyMMddHH`,例如`2020032501`。小时为单位的分区列数据类型不能为 
DATE。
+
+  当指定为 `DAY` 时,动态创建的分区名后缀格式为 `yyyyMMdd`,例如`20200325`。
+
+  当指定为 `WEEK` 时,动态创建的分区名后缀格式为`yyyy_ww`。即当前日期属于这一年的第几周,例如 `2020-03-25` 
创建的分区名后缀为 `2020_13`, 表明目前为 2020 年第 13 周。
+
+  当指定为 `MONTH` 时,动态创建的分区名后缀格式为 `yyyyMM`,例如 `202003`。
+
+  当指定为 `YEAR` 时,动态创建的分区名后缀格式为 `yyyy`,例如 `2020`。
+
+- `dynamic_partition.time_zone`
+
+  动态分区的时区,如果不填写,则默认为当前机器的系统的时区,例如 `Asia/Shanghai`,如果想获取当前支持的时区设置,可以参考 
`https://en.wikipedia.org/wiki/List_of_tz_database_time_zones`。
+
+- `dynamic_partition.start`
+
+  动态分区的起始偏移,为负数。根据 `time_unit` 
属性的不同,以当天(星期/月)为基准,分区范围在此偏移之前的分区将会被删除。如果不填写,则默认为 `-2147483648`,即不删除历史分区。
+
+- `dynamic_partition.end`**(必选参数)**
+
+  动态分区的结束偏移,为正数。根据 `time_unit` 属性的不同,以当天(星期/月)为基准,提前创建对应范围的分区。
+
+- `dynamic_partition.prefix`**(必选参数)**
+
+  动态创建的分区名前缀。
+
+- `dynamic_partition.buckets`
+
+  动态创建的分区所对应的分桶数量。
+
+- `dynamic_partition.replication_num`
+
+  动态创建的分区所对应的副本数量,如果不填写,则默认为该表创建时指定的副本数量。
+
+- `dynamic_partition.start_day_of_week`
+
+  当 `time_unit` 为 `WEEK` 时,该参数用于指定每周的起始点。取值为 1 到 7。其中 1 表示周一,7 表示周日。默认为 
1,即表示每周以周一为起始点。
+
+-  `dynamic_partition.start_day_of_month`
+
+  当 `time_unit` 为 `MONTH` 时,该参数用于指定每月的起始日期。取值为 1 到 28。其中 1 表示每月 1 号,28 表示每月 28 
号。默认为 1,即表示每月以 1 号为起始点。暂不支持以 29、30、31 号为起始日,以避免因闰年或闰月带来的歧义。
+
+- `dynamic_partition.create_history_partition`
+
+  默认为 false。当置为 true 时,Doris 会自动创建所有分区,具体创建规则见下文。同时,FE 的参数 
`max_dynamic_partition_num` 会限制总分区数量,以避免一次性创建过多分区。当期望创建的分区个数大于 
`max_dynamic_partition_num` 值时,操作将被禁止。
+
+  当不指定 `start` 属性时,该参数不生效。
+
+- `dynamic_partition.history_partition_num`
+
+  当`create_history_partition` 为 `true` 时,该参数用于指定创建历史分区数量。默认值为 -1,即未设置。
+
+-  `dynamic_partition.hot_partition_num`
+
+  指定最新的多少个分区为热分区。对于热分区,系统会自动设置其 `storage_medium` 参数为 SSD,并且设置 
`storage_cooldown_time`。
+
+  注意:若存储路径下没有 SSD 磁盘路径,配置该参数会导致动态分区创建失败。
+
+  `hot_partition_num` 是往前 n 天和未来所有分区
+
+  我们举例说明。假设今天是 2021-05-20,按天分区,动态分区的属性设置为:hot_partition_num=2, end=3, 
start=-3。则系统会自动创建以下分区,并且设置 `storage_medium` 和 `storage_cooldown_time` 参数:
+
+  ```Plain
+  p20210517:["2021-05-17", "2021-05-18") storage_medium=HDD 
storage_cooldown_time=9999-12-31 23:59:59
+  p20210518:["2021-05-18", "2021-05-19") storage_medium=HDD 
storage_cooldown_time=9999-12-31 23:59:59
+  p20210519:["2021-05-19", "2021-05-20") storage_medium=SSD 
storage_cooldown_time=2021-05-21 00:00:00
+  p20210520:["2021-05-20", "2021-05-21") storage_medium=SSD 
storage_cooldown_time=2021-05-22 00:00:00
+  p20210521:["2021-05-21", "2021-05-22") storage_medium=SSD 
storage_cooldown_time=2021-05-23 00:00:00
+  p20210522:["2021-05-22", "2021-05-23") storage_medium=SSD 
storage_cooldown_time=2021-05-24 00:00:00
+  p20210523:["2021-05-23", "2021-05-24") storage_medium=SSD 
storage_cooldown_time=2021-05-25 00:00:00
+  ```
+
+-   `dynamic_partition.reserved_history_periods`
+
+  需要保留的历史分区的时间范围。当`dynamic_partition.time_unit` 设置为 "DAY/WEEK/MONTH/YEAR" 
时,需要以 `[yyyy-MM-dd,yyyy-MM-dd],[...,...]` 格式进行设置。当`dynamic_partition.time_unit` 
设置为 "HOUR" 时,需要以 `[yyyy-MM-dd HH:mm:ss,yyyy-MM-dd HH:mm:ss],[...,...]` 
的格式来进行设置。如果不设置,默认为 `"NULL"`。
+
+  举例说明。假设今天是 2021-09-06,按天分类,动态分区的属性设置为:
+
+  `time_unit="DAY/WEEK/MONTH/YEAR", end=3, start=-3, 
reserved_history_periods="[2020-06-01,2020-06-20],[2020-10-31,2020-11-15]"`。
+
+  则系统会自动保留:
+
+  ```Plain
+  ["2020-06-01","2020-06-20"],
+  ["2020-10-31","2020-11-15"]
+  ```
+
+  或者
+
+  `time_unit="HOUR", end=3, start=-3, reserved_history_periods="[2020-06-01 
00:00:00,2020-06-01 03:00:00]"`.
+
+  则系统会自动保留:
+
+  ```Plain
+  ["2020-06-01 00:00:00","2020-06-01 03:00:00"]
+  ```
+
+  这两个时间段的分区。其中,`reserved_history_periods` 的每一个 `[...,...]` 
是一对设置项,两者需要同时被设置,且第一个时间不能大于第二个时间。
+
+-   `dynamic_partition.storage_medium`
+
+  指定创建的动态分区的默认存储介质。默认是 HDD,可选择 SSD。
+
+  注意,当设置为 SSD 时,`hot_partition_num` 属性将不再生效,所有分区将默认为 SSD 存储介质并且冷却时间为 
9999-12-31 23:59:59。
+
+## 创建历史分区规则
+
+当 create_history_partition 为 true,即开启创建历史分区功能时,Doris 会根据 
dynamic_partition.start 和 dynamic_partition.history_partition_num 来决定创建历史分区的个数。
+
+假设需要创建的历史分区数量为 `expect_create_partition_num`,根据不同的设置具体数量如下:
+
+- create_history_partition = true
+
+  dynamic_partition.history_partition_num 未设置,即 -1. 
expect_create_partition_num = end - start;
+
+  dynamic_partition.history_partition_num 已设置 expect_create_partition_num = 
end - max(start, -histoty_partition_num);
+
+- create_history_partition = false 不会创建历史分区,expect_create_partition_num = end 
- 0;
+
+  当 expect_create_partition_num 大于 max_dynamic_partition_num(默认 500)时,禁止创建过多分区。
+
+**举例说明:**
+
+假设今天是 2021-05-20,按天分区,动态分区的属性设置为,`create_history_partition=true, end=3, 
start=-3`,则会根据`history_partition_num`的设置,举例如下。
+
+- `history_partition_num=1`,则系统会自动创建以下分区:
+
+  ```Plain
+  p20210519
+  p20210520
+  p20210521
+  p20210522
+  p20210523
+  ```
+
+- `history_partition_num=5`,则系统会自动创建以下分区:
+
+  ```Plain
+  p20210517
+  p20210518
+  p20210519
+  p20210520
+  p20210521
+  p20210522
+  p20210523
+  ```
+
+- `history_partition_num=-1` 即不设置历史分区数量,则系统会自动创建以下分区:
+
+  ```Plain
+  p20210517
+  p20210518
+  p20210519
+  p20210520
+  p20210521
+  p20210522
+  p20210523
+  ```
+
+## 示例
+
+1. 表 tbl1 分区列 k1 类型为 DATE,创建一个动态分区规则。按天分区,只保留最近 7 天的分区,并且预先创建未来 3 天的分区。
+
+```sql
+CREATE TABLE tbl1
+(
+    k1 DATE,
+    ...
+)
+PARTITION BY RANGE(k1) ()
+DISTRIBUTED BY HASH(k1)
+PROPERTIES
+(
+    "dynamic_partition.enable" = "true",
+    "dynamic_partition.time_unit" = "DAY",
+    "dynamic_partition.start" = "-7",
+    "dynamic_partition.end" = "3",
+    "dynamic_partition.prefix" = "p",
+    "dynamic_partition.buckets" = "32"
+);
+```
+
+假设当前日期为 2020-05-29。则根据以上规则,tbl1 会产生以下分区:
+
+```Plain
+p20200529: ["2020-05-29", "2020-05-30")
+p20200530: ["2020-05-30", "2020-05-31")
+p20200531: ["2020-05-31", "2020-06-01")
+p20200601: ["2020-06-01", "2020-06-02")
+```
+
+在第二天,即 2020-05-30,会创建新的分区 `p20200602: ["2020-06-02", "2020-06-03")`
+
+在 2020-06-06 时,因为 `dynamic_partition.start` 设置为 7,则将删除 7 天前的分区,即删除分区 
`p20200529`。
+
+2. 表 tbl1 分区列 k1 类型为 DATETIME,创建一个动态分区规则。按星期分区,只保留最近 2 个星期的分区,并且预先创建未来 2 
个星期的分区。
+
+```sql
+CREATE TABLE tbl1
+(
+    k1 DATETIME,
+    ...
+)
+PARTITION BY RANGE(k1) ()
+DISTRIBUTED BY HASH(k1)
+PROPERTIES
+(
+    "dynamic_partition.enable" = "true",
+    "dynamic_partition.time_unit" = "WEEK",
+    "dynamic_partition.start" = "-2",
+    "dynamic_partition.end" = "2",
+    "dynamic_partition.prefix" = "p",
+    "dynamic_partition.buckets" = "8"
+);
+```
+
+假设当前日期为 2020-05-29,是 2020 年的第 22 周。默认每周起始为星期一。则以上规则,tbl1 会产生以下分区:
+
+```Plain
+p2020_22: ["2020-05-25 00:00:00", "2020-06-01 00:00:00")
+p2020_23: ["2020-06-01 00:00:00", "2020-06-08 00:00:00")
+p2020_24: ["2020-06-08 00:00:00", "2020-06-15 00:00:00")
+```
+
+其中每个分区的起始日期为当周的周一。同时,因为分区列 k1 的类型为 DATETIME,则分区值会补全时分秒部分,且皆为 0。
+
+在 2020-06-15,即第 25 周时,会删除 2 周前的分区,即删除 `p2020_22`。
+
+在上面的例子中,假设用户指定了周起始日为 `"dynamic_partition.start_day_of_week" = 
"3"`,即以每周三为起始日。则分区如下:
+
+```Plain
+p2020_22: ["2020-05-27 00:00:00", "2020-06-03 00:00:00")
+p2020_23: ["2020-06-03 00:00:00", "2020-06-10 00:00:00")
+p2020_24: ["2020-06-10 00:00:00", "2020-06-17 00:00:00")
+```
+
+即分区范围为当周的周三到下周的周二。
+
+:::caution
+注:2019-12-31 和 2020-01-01 在同一周内,如果分区的起始日期为 2019-12-31,则分区名为 
`p2019_53`,如果分区的起始日期为 2020-01-01,则分区名为 `p2020_01`。
+:::
+
+3.  表 tbl1 分区列 k1 类型为 DATE,创建一个动态分区规则。按月分区,不删除历史分区,并且预先创建未来 2 个月的分区。同时设定以每月 3 
号为起始日。
+
+```sql
+CREATE TABLE tbl1
+(
+    k1 DATE,
+    ...
+)
+PARTITION BY RANGE(k1) ()
+DISTRIBUTED BY HASH(k1)
+PROPERTIES
+(
+    "dynamic_partition.enable" = "true",
+    "dynamic_partition.time_unit" = "MONTH",
+    "dynamic_partition.end" = "2",
+    "dynamic_partition.prefix" = "p",
+    "dynamic_partition.buckets" = "8",
+    "dynamic_partition.start_day_of_month" = "3"
+);
+```
+
+假设当前日期为 2020-05-29。则基于以上规则,tbl1 会产生以下分区:
+
+```Plain
+p202005: ["2020-05-03", "2020-06-03")
+p202006: ["2020-06-03", "2020-07-03")
+p202007: ["2020-07-03", "2020-08-03")
+```
+
+因为没有设置 `dynamic_partition.start`,则不会删除历史分区。
+
+假设今天为 2020-05-20,并设置以每月 28 号为起始日,则分区范围为:
+
+```Plain
+p202004: ["2020-04-28", "2020-05-28")
+p202005: ["2020-05-28", "2020-06-28")
+p202006: ["2020-06-28", "2020-07-28")
+```
+
+## 修改动态分区属性
+
+通过如下命令可以修改动态分区的属性:
+
+```sql
+ALTER TABLE tbl1 SET
+(
+    "dynamic_partition.prop1" = "value1",
+    ...
+);
+```
+
+某些属性的修改可能会产生冲突。假设之前分区粒度为 DAY,并且已经创建了如下分区:
+
+```Plain
+p20200519: ["2020-05-19", "2020-05-20")
+p20200520: ["2020-05-20", "2020-05-21")
+p20200521: ["2020-05-21", "2020-05-22")
+```
+
+如果此时将分区粒度改为 MONTH,则系统会尝试创建范围为 `["2020-05-01", "2020-06-01")` 
的分区,而该分区的分区范围和已有分区冲突,所以无法创建。而范围为 `["2020-06-01", "2020-07-01")` 
的分区可以正常创建。因此,2020-05-22 到 2020-05-30 时间段的分区,需要自行填补。
+
+## 查看动态分区表调度情况
+
+通过以下命令可以进一步查看当前数据库下,所有动态分区表的调度情况:
+
+```sql
+> SHOW DYNAMIC PARTITION TABLES;
++-----------+--------+----------+-------------+------+--------+---------+-----------+----------------+---------------------+--------+------------------------+----------------------+-------------------------+
+| TableName | Enable | TimeUnit | Start       | End  | Prefix | Buckets | 
StartOf   | LastUpdateTime | LastSchedulerTime   | State  | 
LastCreatePartitionMsg | LastDropPartitionMsg | ReservedHistoryPeriods  |
++-----------+--------+----------+-------------+------+--------+---------+-----------+----------------+---------------------+--------+------------------------+----------------------+-------------------------+
+| d3        | true   | WEEK     | -3          | 3    | p      | 1       | 
MONDAY    | N/A            | 2020-05-25 14:29:24 | NORMAL | N/A                 
   | N/A                  | [2021-12-01,2021-12-31] |
+| d5        | true   | DAY      | -7          | 3    | p      | 32      | N/A  
     | N/A            | 2020-05-25 14:29:24 | NORMAL | N/A                    | 
N/A                  | NULL                    |
+| d4        | true   | WEEK     | -3          | 3    | p      | 1       | 
WEDNESDAY | N/A            | 2020-05-25 14:29:24 | NORMAL | N/A                 
   | N/A                  | NULL                    | 
+| d6        | true   | MONTH    | -2147483648 | 2    | p      | 8       | 3rd  
     | N/A            | 2020-05-25 14:29:24 | NORMAL | N/A                    | 
N/A                  | NULL                    |
+| d2        | true   | DAY      | -3          | 3    | p      | 32      | N/A  
     | N/A            | 2020-05-25 14:29:24 | NORMAL | N/A                    | 
N/A                  | NULL                    |
+| d7        | true   | MONTH    | -2147483648 | 5    | p      | 8       | 24th 
     | N/A            | 2020-05-25 14:29:24 | NORMAL | N/A                    | 
N/A                  | NULL                    |
++-----------+--------+----------+-------------+------+--------+---------+-----------+----------------+---------------------+--------+------------------------+----------------------+-------------------------+
+7 rows in set (0.02 sec)
+```
+
+-   LastUpdateTime: 最后一次修改动态分区属性的时间
+
+-   LastSchedulerTime: 最后一次执行动态分区调度的时间
+
+-   State: 最后一次执行动态分区调度的状态
+
+-   LastCreatePartitionMsg: 最后一次执行动态添加分区调度的错误信息
+
+-   LastDropPartitionMsg: 最后一次执行动态删除分区调度的错误信息
+
+## 高级操作
+
+**FE 配置项**
+
+- dynamic_partition_enable
+
+  是否开启 Doris 的动态分区功能。默认为 false,即关闭。该参数只影响动态分区表的分区操作,不影响普通表。可以通过修改 fe.conf 
中的参数并重启 FE 生效。也可以在运行时执行以下命令生效:
+
+  ```Plain
+  # MySQL 协议
+  ADMIN SET FRONTEND CONFIG ("dynamic_partition_enable" = "true")
+
+  # HTTP 协议
+  curl --location-trusted -u username:password -XGET 
http://fe_host:fe_http_port/api/_set_config?dynamic_partition_enable=true
+  ```
+
+  若要全局关闭动态分区,则设置此参数为 false 即可。
+
+- dynamic_partition_check_interval_seconds
+
+  动态分区线程的执行频率,默认为 600(10 分钟),即每 10 分钟进行一次调度。可以通过修改 fe.conf 中的参数并重启 FE 
生效。也可以在运行时执行以下命令修改:
+
+  ```Plain
+  # MySQL 协议
+  ADMIN SET FRONTEND CONFIG ("dynamic_partition_check_interval_seconds" = 
"7200")
+
+  # HTTP 协议
+  curl --location-trusted -u username:password -XGET 
http://fe_host:fe_http_port/api/_set_config?dynamic_partition_check_interval_seconds=432000
+  ```
+
+**动态分区表与手动分区表相互转换**
+
+对于一个表来说,动态分区和手动分区可以自由转换,但二者不能同时存在,有且只有一种状态。
+
+- 手动分区转换为动态分区
+
+  如果一个表在创建时未指定动态分区,可以通过 `ALTER TABLE` 在运行时修改动态分区相关属性来转化为动态分区,具体示例可以通过 `HELP 
ALTER TABLE` 查看。
+
+  开启动态分区功能后,Doris 将不再允许用户手动管理分区,会根据动态分区属性来自动管理分区。
+
+  注意:如果已设定 `dynamic_partition.start`,分区范围在动态分区起始偏移之前的历史分区将会被删除。

Review Comment:
   ```suggestion
   :::warning
     注意:如果已设定 `dynamic_partition.start`,分区范围在动态分区起始偏移之前的历史分区将会被删除。
   :::
   ```
   可能导致数据被删的操作需要高亮标出



##########
i18n/zh-CN/docusaurus-plugin-content-docs/current/table-design/data-partitioning/auto-partitioning.md:
##########
@@ -0,0 +1,280 @@
+---
+{
+    "title": "自动分区",
+    "language": "zh-CN"
+}
+---
+
+<!-- 
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+
+## 使用场景
+
+自动分区功能主要解决了用户预期基于某列对表进行分区操作,但该列的数据分布比较零散或者难以预测,在建表或调整表结构时难以准确创建所需分区,或者分区数量过多以至于手动创建过于繁琐的问题。
+
+以时间类型分区列为例,在动态分区功能中,我们支持了按特定时间周期自动创建新分区以容纳实时数据。对于实时的用户行为日志等场景该功能基本能够满足需求。但在一些更复杂的场景下,例如处理非实时数据时,分区列与当前系统时间无关,且包含大量离散值。此时为提高效率我们希望依据此列对数据进行分区,但数据实际可能涉及的分区无法预先掌握,或者预期所需分区数量过大。这种情况下动态分区或者手动创建分区无法满足我们的需求,自动分区功能很好地覆盖了此类需求。
+
+假设我们的表 DDL 如下:
+
+```sql
+CREATE TABLE `DAILY_TRADE_VALUE`
+(
+    `TRADE_DATE`              datev2 NOT NULL COMMENT '交易日期',
+    `TRADE_ID`                varchar(40) NOT NULL COMMENT '交易编号',
+    ......
+)
+UNIQUE KEY(`TRADE_DATE`, `TRADE_ID`)
+PARTITION BY RANGE(`TRADE_DATE`)
+(
+    PARTITION p_2000 VALUES [('2000-01-01'), ('2001-01-01')),
+    PARTITION p_2001 VALUES [('2001-01-01'), ('2002-01-01')),
+    PARTITION p_2002 VALUES [('2002-01-01'), ('2003-01-01')),
+    PARTITION p_2003 VALUES [('2003-01-01'), ('2004-01-01')),
+    PARTITION p_2004 VALUES [('2004-01-01'), ('2005-01-01')),
+    PARTITION p_2005 VALUES [('2005-01-01'), ('2006-01-01')),
+    PARTITION p_2006 VALUES [('2006-01-01'), ('2007-01-01')),
+    PARTITION p_2007 VALUES [('2007-01-01'), ('2008-01-01')),
+    PARTITION p_2008 VALUES [('2008-01-01'), ('2009-01-01')),
+    PARTITION p_2009 VALUES [('2009-01-01'), ('2010-01-01')),
+    PARTITION p_2010 VALUES [('2010-01-01'), ('2011-01-01')),
+    PARTITION p_2011 VALUES [('2011-01-01'), ('2012-01-01')),
+    PARTITION p_2012 VALUES [('2012-01-01'), ('2013-01-01')),
+    PARTITION p_2013 VALUES [('2013-01-01'), ('2014-01-01')),
+    PARTITION p_2014 VALUES [('2014-01-01'), ('2015-01-01')),
+    PARTITION p_2015 VALUES [('2015-01-01'), ('2016-01-01')),
+    PARTITION p_2016 VALUES [('2016-01-01'), ('2017-01-01')),
+    PARTITION p_2017 VALUES [('2017-01-01'), ('2018-01-01')),
+    PARTITION p_2018 VALUES [('2018-01-01'), ('2019-01-01')),
+    PARTITION p_2019 VALUES [('2019-01-01'), ('2020-01-01')),
+    PARTITION p_2020 VALUES [('2020-01-01'), ('2021-01-01')),
+    PARTITION p_2021 VALUES [('2021-01-01'), ('2022-01-01'))
+)
+DISTRIBUTED BY HASH(`TRADE_DATE`) BUCKETS 10
+PROPERTIES (
+  "replication_num" = "1"
+);
+```
+
+
+
+该表内存储了大量业务历史数据,依据交易发生的日期进行分区。可以看到在建表时,我们需要预先手动创建分区。如果分区列的数据范围发生变化,例如上表中增加了 
2022 
年的数据,则我们需要通过[ALTER-TABLE-PARTITION](../sql-manual/sql-statements/Data-Definition-Statements/Alter/ALTER-TABLE-PARTITION)对表的分区进行更改。如果这种分区需要变更,或者进行更细粒度的细分,修改起来非常繁琐。此时我们就可以使用
 AUTO PARTITION 改写该表 DDL。
+
+## 语法
+
+建表时,使用以下语法填充[CREATE-TABLE](../sql-manual/sql-statements/Data-Definition-Statements/Create/CREATE-TABLE)时的`partition_info`部分:
+
+1. AUTO RANGE PARTITION:
+
+   ```sql
+   AUTO PARTITION BY RANGE (FUNC_CALL_EXPR)
+   (
+   )
+   ```
+
+   
+
+   其中
+
+   ```sql
+   FUNC_CALL_EXPR ::= date_trunc ( <partition_column>, '<interval>' )
+   ```
+
+   
+
+​      注意:在 2.1.0 版本,`FUNC_CALL_EXPR` 外围不需要被括号包围。
+
+2. AUTO LIST PARTITION:
+
+```sql
+AUTO PARTITION BY LIST(`partition_col`)
+(
+)
+```
+
+
+
+### 用法示例
+
+1. AUTO RANGE PARTITION
+
+   ```sql
+   CREATE TABLE `date_table` (
+       `TIME_STAMP` datev2 NOT NULL COMMENT '采集日期'
+   ) ENGINE=OLAP
+   DUPLICATE KEY(`TIME_STAMP`)
+   AUTO PARTITION BY RANGE (date_trunc(`TIME_STAMP`, 'month'))
+   (
+   )
+   DISTRIBUTED BY HASH(`TIME_STAMP`) BUCKETS 10
+   PROPERTIES (
+   "replication_allocation" = "tag.location.default: 1"
+   );
+   ```
+
+   
+
+2. AUTO LIST PARTITION
+
+   ```sql
+   CREATE TABLE `str_table` (
+       `str` varchar not null
+   ) ENGINE=OLAP
+   DUPLICATE KEY(`str`)
+   AUTO PARTITION BY LIST (`str`)
+   (
+   )
+   DISTRIBUTED BY HASH(`str`) BUCKETS 10
+   PROPERTIES (
+   "replication_allocation" = "tag.location.default: 1"
+   );
+   ```
+
+### 约束
+
+1. 在 AUTO LIST PARTITION 中,**分区名长度不得超过 50**. 
该长度来自于对应数据行上各分区列内容的拼接与转义,因此实际容许长度可能更短。
+2. 在 AUTO RANGE PARTITION 中,分区函数仅支持 `date_trunc`,分区列仅支持 `DATE` 或者 `DATETIME` 
类型;
+3. 在 AUTO LIST PARTITION 中,不支持函数调用,分区列支持 `BOOLEAN`, `TINYINT`, `SMALLINT`, 
`INT`, `BIGINT`, `LARGEINT`, `DATE`, `DATETIME`, `CHAR`, `VARCHAR` 数据类型,分区值为枚举值。
+4. 在 AUTO LIST PARTITION 中,分区列的每个当前不存在对应分区的取值,都会创建一个独立的新 PARTITION。
+
+### NULL 值分区
+
+当开启 session variable `allow_partition_column_nullable` 后,LIST 和 RANGE 分区都支持 
NULL 列作为分区列。当分区列实际遇到 NULL 值的插入时:
+
+1. 对于 AUTO LIST PARTITION,会自动创建对应的 NULL 值分区:
+
+```sql
+mysql> create table auto_null_list(
+    -> k0 varchar null
+    -> )
+    -> auto partition by list (k0)
+    -> (
+    -> )
+    -> DISTRIBUTED BY HASH(`k0`) BUCKETS 1
+    -> properties("replication_num" = "1");
+Query OK, 0 rows affected (0.10 sec)
+
+mysql> insert into auto_null_list values (null);
+Query OK, 1 row affected (0.28 sec)
+
+mysql> select * from auto_null_list;
++------+
+| k0   |
++------+
+| NULL |
++------+
+1 row in set (0.20 sec)
+
+mysql> select * from auto_null_list partition(pX);
++------+
+| k0   |
++------+
+| NULL |
++------+
+1 row in set (0.20 sec)
+```
+
+
+
+1. 对于 AUTO RANGE PARTITION,**不支持 NULLABLE 列作为分区列**。
+
+```sql
+mysql>  CREATE TABLE `range_table_nullable` (
+    ->      `k1` INT,
+    ->      `k2` DATETIMEV2(3),
+    ->      `k3` DATETIMEV2(6)
+    ->  ) ENGINE=OLAP
+    ->  DUPLICATE KEY(`k1`)
+    ->  AUTO PARTITION BY RANGE (date_trunc(`k2`, 'day'))
+    ->  (
+    ->  )
+    ->  DISTRIBUTED BY HASH(`k1`) BUCKETS 16
+    ->  PROPERTIES (
+    ->  "replication_allocation" = "tag.location.default: 1"
+    ->  );
+ERROR 1105 (HY000): errCode = 2, detailMessage = AUTO RANGE PARTITION doesn't 
support NULL column
+```
+
+
+
+## 场景示例
+
+在使用场景一节中的示例,在使用 AUTO PARTITION 后,该表 DDL 可以改写为:
+
+```sql
+CREATE TABLE `DAILY_TRADE_VALUE`
+(
+    `TRADE_DATE`              datev2 NOT NULL COMMENT '交易日期',
+    `TRADE_ID`                varchar(40) NOT NULL COMMENT '交易编号',
+    ......
+)
+UNIQUE KEY(`TRADE_DATE`, `TRADE_ID`)
+AUTO PARTITION BY RANGE (date_trunc(`TRADE_DATE`, 'year'))
+(
+)
+DISTRIBUTED BY HASH(`TRADE_DATE`) BUCKETS 10
+PROPERTIES (
+  "replication_num" = "1"
+);
+```
+
+
+
+此时新表没有默认分区:
+
+```sql
+mysql> show partitions from `DAILY_TRADE_VALUE`;
+Empty set (0.12 sec)
+```
+
+经过插入数据后再查看,发现该表已经创建了对应的分区:
+
+```sql
+mysql> insert into `DAILY_TRADE_VALUE` values ('2012-12-13', 1), 
('2008-02-03', 2), ('2014-11-11', 3);
+Query OK, 3 rows affected (0.88 sec)
+
+mysql> show partitions from `DAILY_TRADE_VALUE`;
++-------------+-----------------+----------------+---------------------+--------+--------------+--------------------------------------------------------------------------------+-----------------+---------+----------------+---------------+---------------------+---------------------+--------------------------+----------+------------+-------------------------+-----------+
+| PartitionId | PartitionName   | VisibleVersion | VisibleVersionTime  | State 
 | PartitionKey | Range                                                         
                 | DistributionKey | Buckets | ReplicationNum | StorageMedium | 
CooldownTime        | RemoteStoragePolicy | LastConsistencyCheckTime | DataSize 
| IsInMemory | ReplicaAllocation       | IsMutable |
++-------------+-----------------+----------------+---------------------+--------+--------------+--------------------------------------------------------------------------------+-----------------+---------+----------------+---------------+---------------------+---------------------+--------------------------+----------+------------+-------------------------+-----------+
+| 180060      | p20080101000000 | 2              | 2023-09-18 21:49:29 | 
NORMAL | TRADE_DATE   | [types: [DATEV2]; keys: [2008-01-01]; ..types: 
[DATEV2]; keys: [2009-01-01]; ) | TRADE_DATE      | 10      | 1              | 
HDD           | 9999-12-31 23:59:59 |                     | NULL                
     | 0.000    | false      | tag.location.default: 1 | true      |
+| 180039      | p20120101000000 | 2              | 2023-09-18 21:49:29 | 
NORMAL | TRADE_DATE   | [types: [DATEV2]; keys: [2012-01-01]; ..types: 
[DATEV2]; keys: [2013-01-01]; ) | TRADE_DATE      | 10      | 1              | 
HDD           | 9999-12-31 23:59:59 |                     | NULL                
     | 0.000    | false      | tag.location.default: 1 | true      |
+| 180018      | p20140101000000 | 2              | 2023-09-18 21:49:29 | 
NORMAL | TRADE_DATE   | [types: [DATEV2]; keys: [2014-01-01]; ..types: 
[DATEV2]; keys: [2015-01-01]; ) | TRADE_DATE      | 10      | 1              | 
HDD           | 9999-12-31 23:59:59 |                     | NULL                
     | 0.000    | false      | tag.location.default: 1 | true      |
++-------------+-----------------+----------------+---------------------+--------+--------------+--------------------------------------------------------------------------------+-----------------+---------+----------------+---------------+---------------------+---------------------+--------------------------+----------+------------+-------------------------+-----------+
+3 rows in set (0.12 sec)
+                                                                               
                   
+```
+
+经过自动分区功能所创建的 PARTITION,与手动创建的 PARTITION 具有完全一致的功能性质。
+
+## 与动态分区联用
+
+为使分区逻辑清晰,Doris 禁止自动分区(Auto Partition)和动态分区(Dynamic 
Partition)同时作用于一张表上,这种用法容易引发误用,应当以单独的自动分区功能代替。
+
+注意:在 Doris 2.1 的某些早期版本中,该功能未被禁止,但不推荐使用。
+
+## 注意事项
+
+- 如同普通分区表一样,AUTO LIST PARTITION 支持多列分区,语法并无区别。
+- 在数据的插入或导入过程中如果创建了分区,而整个导入过程没有完成(失败或被取消),被创建的分区不会被自动删除。
+- 使用 AUTO PARTITION 的表,只是分区创建方式上由手动转为了自动。表及其所创建分区的原本使用方法都与非 AUTO PARTITION 
的表或分区相同。
+- 为防止意外创建过多分区,我们通过[FE 
配置项](../admin-manual/config/fe-config)中的`max_auto_partition_num`控制了一个 AUTO 
PARTITION 表最大容纳分区数。如有需要可以调整该值
+- 向开启了 AUTO PARTITION 的表导入数据时,Coordinator 发送数据的轮询间隔与普通表有所不同。具体请见[BE 
配置项](../admin-manual/config/be-config)中的`olap_table_sink_send_interval_auto_partition_factor`。开启前移(`enable_memtable_on_sink_node
 = true`)后该变量不产生影响。

Review Comment:
   ```suggestion
   - 向开启了 AUTO PARTITION 的表导入数据时,Coordinator 发送数据的轮询间隔与普通表有所不同。具体请见[BE 
配置项](../../admin-manual/config/be-config)中的`olap_table_sink_send_interval_auto_partition_factor`。开启前移(`enable_memtable_on_sink_node
 = true`)后该变量不产生影响。
   ```



##########
i18n/zh-CN/docusaurus-plugin-content-docs/current/table-design/data-partitioning/auto-partitioning.md:
##########
@@ -0,0 +1,280 @@
+---
+{
+    "title": "自动分区",
+    "language": "zh-CN"
+}
+---
+
+<!-- 
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+
+## 使用场景
+
+自动分区功能主要解决了用户预期基于某列对表进行分区操作,但该列的数据分布比较零散或者难以预测,在建表或调整表结构时难以准确创建所需分区,或者分区数量过多以至于手动创建过于繁琐的问题。
+
+以时间类型分区列为例,在动态分区功能中,我们支持了按特定时间周期自动创建新分区以容纳实时数据。对于实时的用户行为日志等场景该功能基本能够满足需求。但在一些更复杂的场景下,例如处理非实时数据时,分区列与当前系统时间无关,且包含大量离散值。此时为提高效率我们希望依据此列对数据进行分区,但数据实际可能涉及的分区无法预先掌握,或者预期所需分区数量过大。这种情况下动态分区或者手动创建分区无法满足我们的需求,自动分区功能很好地覆盖了此类需求。
+
+假设我们的表 DDL 如下:
+
+```sql
+CREATE TABLE `DAILY_TRADE_VALUE`
+(
+    `TRADE_DATE`              datev2 NOT NULL COMMENT '交易日期',
+    `TRADE_ID`                varchar(40) NOT NULL COMMENT '交易编号',
+    ......
+)
+UNIQUE KEY(`TRADE_DATE`, `TRADE_ID`)
+PARTITION BY RANGE(`TRADE_DATE`)
+(
+    PARTITION p_2000 VALUES [('2000-01-01'), ('2001-01-01')),
+    PARTITION p_2001 VALUES [('2001-01-01'), ('2002-01-01')),
+    PARTITION p_2002 VALUES [('2002-01-01'), ('2003-01-01')),
+    PARTITION p_2003 VALUES [('2003-01-01'), ('2004-01-01')),
+    PARTITION p_2004 VALUES [('2004-01-01'), ('2005-01-01')),
+    PARTITION p_2005 VALUES [('2005-01-01'), ('2006-01-01')),
+    PARTITION p_2006 VALUES [('2006-01-01'), ('2007-01-01')),
+    PARTITION p_2007 VALUES [('2007-01-01'), ('2008-01-01')),
+    PARTITION p_2008 VALUES [('2008-01-01'), ('2009-01-01')),
+    PARTITION p_2009 VALUES [('2009-01-01'), ('2010-01-01')),
+    PARTITION p_2010 VALUES [('2010-01-01'), ('2011-01-01')),
+    PARTITION p_2011 VALUES [('2011-01-01'), ('2012-01-01')),
+    PARTITION p_2012 VALUES [('2012-01-01'), ('2013-01-01')),
+    PARTITION p_2013 VALUES [('2013-01-01'), ('2014-01-01')),
+    PARTITION p_2014 VALUES [('2014-01-01'), ('2015-01-01')),
+    PARTITION p_2015 VALUES [('2015-01-01'), ('2016-01-01')),
+    PARTITION p_2016 VALUES [('2016-01-01'), ('2017-01-01')),
+    PARTITION p_2017 VALUES [('2017-01-01'), ('2018-01-01')),
+    PARTITION p_2018 VALUES [('2018-01-01'), ('2019-01-01')),
+    PARTITION p_2019 VALUES [('2019-01-01'), ('2020-01-01')),
+    PARTITION p_2020 VALUES [('2020-01-01'), ('2021-01-01')),
+    PARTITION p_2021 VALUES [('2021-01-01'), ('2022-01-01'))
+)
+DISTRIBUTED BY HASH(`TRADE_DATE`) BUCKETS 10
+PROPERTIES (
+  "replication_num" = "1"
+);
+```
+
+
+
+该表内存储了大量业务历史数据,依据交易发生的日期进行分区。可以看到在建表时,我们需要预先手动创建分区。如果分区列的数据范围发生变化,例如上表中增加了 
2022 
年的数据,则我们需要通过[ALTER-TABLE-PARTITION](../sql-manual/sql-statements/Data-Definition-Statements/Alter/ALTER-TABLE-PARTITION)对表的分区进行更改。如果这种分区需要变更,或者进行更细粒度的细分,修改起来非常繁琐。此时我们就可以使用
 AUTO PARTITION 改写该表 DDL。
+
+## 语法
+
+建表时,使用以下语法填充[CREATE-TABLE](../sql-manual/sql-statements/Data-Definition-Statements/Create/CREATE-TABLE)时的`partition_info`部分:
+
+1. AUTO RANGE PARTITION:
+
+   ```sql
+   AUTO PARTITION BY RANGE (FUNC_CALL_EXPR)
+   (
+   )
+   ```
+
+   
+
+   其中
+
+   ```sql
+   FUNC_CALL_EXPR ::= date_trunc ( <partition_column>, '<interval>' )
+   ```
+
+   
+
+​      注意:在 2.1.0 版本,`FUNC_CALL_EXPR` 外围不需要被括号包围。
+
+2. AUTO LIST PARTITION:
+
+```sql
+AUTO PARTITION BY LIST(`partition_col`)
+(
+)
+```
+
+
+
+### 用法示例
+
+1. AUTO RANGE PARTITION
+
+   ```sql
+   CREATE TABLE `date_table` (
+       `TIME_STAMP` datev2 NOT NULL COMMENT '采集日期'
+   ) ENGINE=OLAP
+   DUPLICATE KEY(`TIME_STAMP`)
+   AUTO PARTITION BY RANGE (date_trunc(`TIME_STAMP`, 'month'))
+   (
+   )
+   DISTRIBUTED BY HASH(`TIME_STAMP`) BUCKETS 10
+   PROPERTIES (
+   "replication_allocation" = "tag.location.default: 1"
+   );
+   ```
+
+   
+
+2. AUTO LIST PARTITION
+
+   ```sql
+   CREATE TABLE `str_table` (
+       `str` varchar not null
+   ) ENGINE=OLAP
+   DUPLICATE KEY(`str`)
+   AUTO PARTITION BY LIST (`str`)
+   (
+   )
+   DISTRIBUTED BY HASH(`str`) BUCKETS 10
+   PROPERTIES (
+   "replication_allocation" = "tag.location.default: 1"
+   );
+   ```
+
+### 约束
+
+1. 在 AUTO LIST PARTITION 中,**分区名长度不得超过 50**. 
该长度来自于对应数据行上各分区列内容的拼接与转义,因此实际容许长度可能更短。
+2. 在 AUTO RANGE PARTITION 中,分区函数仅支持 `date_trunc`,分区列仅支持 `DATE` 或者 `DATETIME` 
类型;
+3. 在 AUTO LIST PARTITION 中,不支持函数调用,分区列支持 `BOOLEAN`, `TINYINT`, `SMALLINT`, 
`INT`, `BIGINT`, `LARGEINT`, `DATE`, `DATETIME`, `CHAR`, `VARCHAR` 数据类型,分区值为枚举值。
+4. 在 AUTO LIST PARTITION 中,分区列的每个当前不存在对应分区的取值,都会创建一个独立的新 PARTITION。
+
+### NULL 值分区
+
+当开启 session variable `allow_partition_column_nullable` 后,LIST 和 RANGE 分区都支持 
NULL 列作为分区列。当分区列实际遇到 NULL 值的插入时:
+
+1. 对于 AUTO LIST PARTITION,会自动创建对应的 NULL 值分区:
+
+```sql
+mysql> create table auto_null_list(
+    -> k0 varchar null
+    -> )
+    -> auto partition by list (k0)
+    -> (
+    -> )
+    -> DISTRIBUTED BY HASH(`k0`) BUCKETS 1
+    -> properties("replication_num" = "1");
+Query OK, 0 rows affected (0.10 sec)
+
+mysql> insert into auto_null_list values (null);
+Query OK, 1 row affected (0.28 sec)
+
+mysql> select * from auto_null_list;
++------+
+| k0   |
++------+
+| NULL |
++------+
+1 row in set (0.20 sec)
+
+mysql> select * from auto_null_list partition(pX);
++------+
+| k0   |
++------+
+| NULL |
++------+
+1 row in set (0.20 sec)
+```
+
+
+
+1. 对于 AUTO RANGE PARTITION,**不支持 NULLABLE 列作为分区列**。
+
+```sql
+mysql>  CREATE TABLE `range_table_nullable` (
+    ->      `k1` INT,
+    ->      `k2` DATETIMEV2(3),
+    ->      `k3` DATETIMEV2(6)
+    ->  ) ENGINE=OLAP
+    ->  DUPLICATE KEY(`k1`)
+    ->  AUTO PARTITION BY RANGE (date_trunc(`k2`, 'day'))
+    ->  (
+    ->  )
+    ->  DISTRIBUTED BY HASH(`k1`) BUCKETS 16
+    ->  PROPERTIES (
+    ->  "replication_allocation" = "tag.location.default: 1"
+    ->  );
+ERROR 1105 (HY000): errCode = 2, detailMessage = AUTO RANGE PARTITION doesn't 
support NULL column
+```
+
+
+
+## 场景示例
+
+在使用场景一节中的示例,在使用 AUTO PARTITION 后,该表 DDL 可以改写为:
+
+```sql
+CREATE TABLE `DAILY_TRADE_VALUE`
+(
+    `TRADE_DATE`              datev2 NOT NULL COMMENT '交易日期',
+    `TRADE_ID`                varchar(40) NOT NULL COMMENT '交易编号',
+    ......
+)
+UNIQUE KEY(`TRADE_DATE`, `TRADE_ID`)
+AUTO PARTITION BY RANGE (date_trunc(`TRADE_DATE`, 'year'))
+(
+)
+DISTRIBUTED BY HASH(`TRADE_DATE`) BUCKETS 10
+PROPERTIES (
+  "replication_num" = "1"
+);
+```
+
+
+
+此时新表没有默认分区:
+
+```sql
+mysql> show partitions from `DAILY_TRADE_VALUE`;
+Empty set (0.12 sec)
+```
+
+经过插入数据后再查看,发现该表已经创建了对应的分区:
+
+```sql
+mysql> insert into `DAILY_TRADE_VALUE` values ('2012-12-13', 1), 
('2008-02-03', 2), ('2014-11-11', 3);
+Query OK, 3 rows affected (0.88 sec)
+
+mysql> show partitions from `DAILY_TRADE_VALUE`;
++-------------+-----------------+----------------+---------------------+--------+--------------+--------------------------------------------------------------------------------+-----------------+---------+----------------+---------------+---------------------+---------------------+--------------------------+----------+------------+-------------------------+-----------+
+| PartitionId | PartitionName   | VisibleVersion | VisibleVersionTime  | State 
 | PartitionKey | Range                                                         
                 | DistributionKey | Buckets | ReplicationNum | StorageMedium | 
CooldownTime        | RemoteStoragePolicy | LastConsistencyCheckTime | DataSize 
| IsInMemory | ReplicaAllocation       | IsMutable |
++-------------+-----------------+----------------+---------------------+--------+--------------+--------------------------------------------------------------------------------+-----------------+---------+----------------+---------------+---------------------+---------------------+--------------------------+----------+------------+-------------------------+-----------+
+| 180060      | p20080101000000 | 2              | 2023-09-18 21:49:29 | 
NORMAL | TRADE_DATE   | [types: [DATEV2]; keys: [2008-01-01]; ..types: 
[DATEV2]; keys: [2009-01-01]; ) | TRADE_DATE      | 10      | 1              | 
HDD           | 9999-12-31 23:59:59 |                     | NULL                
     | 0.000    | false      | tag.location.default: 1 | true      |
+| 180039      | p20120101000000 | 2              | 2023-09-18 21:49:29 | 
NORMAL | TRADE_DATE   | [types: [DATEV2]; keys: [2012-01-01]; ..types: 
[DATEV2]; keys: [2013-01-01]; ) | TRADE_DATE      | 10      | 1              | 
HDD           | 9999-12-31 23:59:59 |                     | NULL                
     | 0.000    | false      | tag.location.default: 1 | true      |
+| 180018      | p20140101000000 | 2              | 2023-09-18 21:49:29 | 
NORMAL | TRADE_DATE   | [types: [DATEV2]; keys: [2014-01-01]; ..types: 
[DATEV2]; keys: [2015-01-01]; ) | TRADE_DATE      | 10      | 1              | 
HDD           | 9999-12-31 23:59:59 |                     | NULL                
     | 0.000    | false      | tag.location.default: 1 | true      |
++-------------+-----------------+----------------+---------------------+--------+--------------+--------------------------------------------------------------------------------+-----------------+---------+----------------+---------------+---------------------+---------------------+--------------------------+----------+------------+-------------------------+-----------+
+3 rows in set (0.12 sec)
+                                                                               
                   
+```
+
+经过自动分区功能所创建的 PARTITION,与手动创建的 PARTITION 具有完全一致的功能性质。
+
+## 与动态分区联用
+
+为使分区逻辑清晰,Doris 禁止自动分区(Auto Partition)和动态分区(Dynamic 
Partition)同时作用于一张表上,这种用法容易引发误用,应当以单独的自动分区功能代替。
+
+注意:在 Doris 2.1 的某些早期版本中,该功能未被禁止,但不推荐使用。
+
+## 注意事项
+
+- 如同普通分区表一样,AUTO LIST PARTITION 支持多列分区,语法并无区别。
+- 在数据的插入或导入过程中如果创建了分区,而整个导入过程没有完成(失败或被取消),被创建的分区不会被自动删除。
+- 使用 AUTO PARTITION 的表,只是分区创建方式上由手动转为了自动。表及其所创建分区的原本使用方法都与非 AUTO PARTITION 
的表或分区相同。
+- 为防止意外创建过多分区,我们通过[FE 
配置项](../admin-manual/config/fe-config)中的`max_auto_partition_num`控制了一个 AUTO 
PARTITION 表最大容纳分区数。如有需要可以调整该值
+- 向开启了 AUTO PARTITION 的表导入数据时,Coordinator 发送数据的轮询间隔与普通表有所不同。具体请见[BE 
配置项](../admin-manual/config/be-config)中的`olap_table_sink_send_interval_auto_partition_factor`。开启前移(`enable_memtable_on_sink_node
 = true`)后该变量不产生影响。
+- 
在使用[insert-overwrite](../sql-manual/sql-statements/Data-Manipulation-Statements/Manipulation/INSERT-OVERWRITE)插入数据时,如果指定了覆写的
 partition,则 AUTO PARTITION 表在此过程中表现得如同普通表,不创建新的分区。

Review Comment:
   ```suggestion
   - 
在使用[insert-overwrite](../../sql-manual/sql-statements/Data-Manipulation-Statements/Manipulation/INSERT-OVERWRITE)插入数据时,如果指定了覆写的
 partition,则 AUTO PARTITION 表在此过程中表现得如同普通表,不创建新的分区。
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to