This is an automated email from the ASF dual-hosted git repository.

luzhijing pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris-website.git


The following commit(s) were added to refs/heads/master by this push:
     new 64dc084264 [docs](function) support auto_partition_name function (#945)
64dc084264 is described below

commit 64dc0842647a872b8aa457965355357cbf8ffc72
Author: Uniqueyou <134280716+wyxxx...@users.noreply.github.com>
AuthorDate: Mon Aug 5 20:57:45 2024 +0800

    [docs](function) support auto_partition_name function (#945)
    
    https://github.com/apache/doris/pull/34258
---
 .../string-functions/auto_partition_name.md        | 116 +++++++++++++++++++
 .../string-functions/auto_partition_name.md        | 116 +++++++++++++++++++
 .../string-functions/auto_partition_name.md        | 128 +++++++++++++++++++++
 .../string-functions/auto_partition_name.md        | 128 +++++++++++++++++++++
 sidebars.json                                      |   3 +-
 .../string-functions/auto_partition_name.md        | 116 +++++++++++++++++++
 .../string-functions/auto_partition_name.md        | 116 +++++++++++++++++++
 versioned_sidebars/version-2.1-sidebars.json       |   3 +-
 versioned_sidebars/version-3.0-sidebars.json       |   3 +-
 9 files changed, 726 insertions(+), 3 deletions(-)

diff --git 
a/docs/sql-manual/sql-functions/string-functions/auto_partition_name.md 
b/docs/sql-manual/sql-functions/string-functions/auto_partition_name.md
new file mode 100644
index 0000000000..c9b1dd0421
--- /dev/null
+++ b/docs/sql-manual/sql-functions/string-functions/auto_partition_name.md
@@ -0,0 +1,116 @@
+---
+{
+    "title": "AUTO_PARTITION_NAME",
+    "language": "en"
+}
+---
+
+<!-- 
+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.
+-->
+
+## auto_partition_name
+### description
+#### Syntax
+
+`VARCHAR AUTO_PARTITION_NAME('RANGE', 'VARCHAR unit', DATETIME datetime)`
+
+`VARCHAR AUTO_PARTITION_NAME('LIST', VARCHAR,...)`
+
+Generate datetime partition names by unit following RANGE's partition name 
rules
+
+Convert strings to partition names following LIST's partition name rules
+
+The datetime parameter is a legal date expression.
+
+The unit parameter is the time interval you want, the available values are: 
[`second`, `minute`, `hour`, `day`, `month`, `year`].
+If unit does not match one of these options, a syntax error will be returned. 
+### example
+
+```
+mysql> select auto_partition_name('range', 'years', '123');
+ERROR 1105 (HY000): errCode = 2, detailMessage = range auto_partition_name 
must accept year|month|day|hour|minute|second for 2nd argument
+
+mysql> select auto_partition_name('range', 'year', '2022-12-12 19:20:30');
++---------------------------------------------------------------+
+| auto_partition_name('range', 'year', '2022-12-12 19:20:30')   |
++---------------------------------------------------------------+
+| p20220101000000                                               |
++---------------------------------------------------------------+
+
+mysql> select auto_partition_name('range', 'month', '2022-12-12 19:20:30');
++---------------------------------------------------------------+
+| auto_partition_name('range', 'month', '2022-12-12 19:20:30')  |
++---------------------------------------------------------------+
+| p20221201000000                                               |
++---------------------------------------------------------------+
+
+mysql> select auto_partition_name('range', 'day', '2022-12-12 19:20:30');
++---------------------------------------------------------------+
+| auto_partition_name('range', 'day', '2022-12-12 19:20:30')    |
++---------------------------------------------------------------+
+| p20221212000000                                               |
++---------------------------------------------------------------+
+
+mysql> select auto_partition_name('range', 'hour', '2022-12-12 19:20:30');
++---------------------------------------------------------------+
+| auto_partition_name('range', 'hour', '2022-12-12 19:20:30')   |
++---------------------------------------------------------------+
+| p20221212190000                                               |
++---------------------------------------------------------------+
+
+mysql> select auto_partition_name('range', 'minute', '2022-12-12 19:20:30');
++---------------------------------------------------------------+
+| auto_partition_name('range', 'minute', '2022-12-12 19:20:30') |
++---------------------------------------------------------------+
+| p20221212192000                                               |
++---------------------------------------------------------------+
+
+mysql> select auto_partition_name('range', 'second', '2022-12-12 19:20:30');
++---------------------------------------------------------------+
+| auto_partition_name('range', 'second', '2022-12-12 19:20:30') |
++---------------------------------------------------------------+
+| p20221212192030                                               |
++---------------------------------------------------------------+
+
+mysql> select auto_partition_name('list', 'helloworld');
++-------------------------------------------+
+| auto_partition_name('list', 'helloworld') |
++-------------------------------------------+
+| phelloworld10                             |
++-------------------------------------------+
+
+mysql> select auto_partition_name('list', 'hello', 'world');
++-----------------------------------------------+
+| auto_partition_name('list', 'hello', 'world') |
++-----------------------------------------------+
+| phello5world5                                 |
++-----------------------------------------------+
+
+mysql> select auto_partition_name('list', "你好");
++------------------------------------+
+| auto_partition_name('list', "你好") |
++------------------------------------+
+| p4f60597d2                         |
++------------------------------------+
+
+```
+
+### keywords
+
+    AUTO_PARTITION_NAME,AUTO,PARTITION,NAME
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/string-functions/auto_partition_name.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/string-functions/auto_partition_name.md
new file mode 100644
index 0000000000..b7128c3a29
--- /dev/null
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/string-functions/auto_partition_name.md
@@ -0,0 +1,116 @@
+---
+{
+    "title": "AUTO_PARTITION_NAME",
+    "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.
+-->
+
+## auto_partition_name
+### description
+#### Syntax
+
+`VARCHAR AUTO_PARTITION_NAME('RANGE', 'VARCHAR unit', DATETIME datetime)`
+
+`VARCHAR AUTO_PARTITION_NAME('LIST', VARCHAR,...)`
+
+遵循 RANGE 的分区名规则将 datetime 按照 unit 生成分区名
+
+遵循 LIST 的分区名规则将字符串转换为分区名
+
+datetime 参数是合法的日期表达式。
+
+unit 参数是您希望的时间间隔,可选的值如下:[`second`,`minute`,`hour`,`day`,`month`,`year`]。
+如果 unit 不符合上述可选值,结果将返回语法错误。 
+### example
+
+```
+mysql> select auto_partition_name('range', 'years', '123');
+ERROR 1105 (HY000): errCode = 2, detailMessage = range auto_partition_name 
must accept year|month|day|hour|minute|second for 2nd argument
+
+mysql> select auto_partition_name('range', 'year', '2022-12-12 19:20:30');
++---------------------------------------------------------------+
+| auto_partition_name('range', 'year', '2022-12-12 19:20:30')   |
++---------------------------------------------------------------+
+| p20220101000000                                               |
++---------------------------------------------------------------+
+
+mysql> select auto_partition_name('range', 'month', '2022-12-12 19:20:30');
++---------------------------------------------------------------+
+| auto_partition_name('range', 'month', '2022-12-12 19:20:30')  |
++---------------------------------------------------------------+
+| p20221201000000                                               |
++---------------------------------------------------------------+
+
+mysql> select auto_partition_name('range', 'day', '2022-12-12 19:20:30');
++---------------------------------------------------------------+
+| auto_partition_name('range', 'day', '2022-12-12 19:20:30')    |
++---------------------------------------------------------------+
+| p20221212000000                                               |
++---------------------------------------------------------------+
+
+mysql> select auto_partition_name('range', 'hour', '2022-12-12 19:20:30');
++---------------------------------------------------------------+
+| auto_partition_name('range', 'hour', '2022-12-12 19:20:30')   |
++---------------------------------------------------------------+
+| p20221212190000                                               |
++---------------------------------------------------------------+
+
+mysql> select auto_partition_name('range', 'minute', '2022-12-12 19:20:30');
++---------------------------------------------------------------+
+| auto_partition_name('range', 'minute', '2022-12-12 19:20:30') |
++---------------------------------------------------------------+
+| p20221212192000                                               |
++---------------------------------------------------------------+
+
+mysql> select auto_partition_name('range', 'second', '2022-12-12 19:20:30');
++---------------------------------------------------------------+
+| auto_partition_name('range', 'second', '2022-12-12 19:20:30') |
++---------------------------------------------------------------+
+| p20221212192030                                               |
++---------------------------------------------------------------+
+
+mysql> select auto_partition_name('list', 'helloworld');
++-------------------------------------------+
+| auto_partition_name('list', 'helloworld') |
++-------------------------------------------+
+| phelloworld10                             |
++-------------------------------------------+
+
+mysql> select auto_partition_name('list', 'hello', 'world');
++-----------------------------------------------+
+| auto_partition_name('list', 'hello', 'world') |
++-----------------------------------------------+
+| phello5world5                                 |
++-----------------------------------------------+
+
+mysql> select auto_partition_name('list', "你好");
++------------------------------------+
+| auto_partition_name('list', "你好") |
++------------------------------------+
+| p4f60597d2                         |
++------------------------------------+
+
+```
+
+### keywords
+
+    AUTO_PARTITION_NAME,AUTO,PARTITION,NAME
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/string-functions/auto_partition_name.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/string-functions/auto_partition_name.md
new file mode 100644
index 0000000000..3a65838008
--- /dev/null
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-2.1/sql-manual/sql-functions/string-functions/auto_partition_name.md
@@ -0,0 +1,128 @@
+---
+{
+    "title": "auto_partition_name",
+    "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.
+-->
+
+## auto_partition_name
+
+<version since="2.1.6"> 
+
+auto_partition_name
+
+</version>
+
+### description
+
+:::info 备注
+自 2.1.6 开始支持 auto_partition_name 用法
+:::
+
+#### Syntax
+
+`VARCHAR AUTO_PARTITION_NAME('RANGE', 'VARCHAR unit', DATETIME datetime)`
+
+`VARCHAR AUTO_PARTITION_NAME('LIST', VARCHAR,...)`
+
+遵循 RANGE 的分区名规则将 datetime 按照 unit 生成分区名
+
+遵循 LIST 的分区名规则将字符串转换为分区名
+
+datetime 参数是合法的日期表达式。
+
+unit 参数是您希望的时间间隔,可选的值如下:[`second`,`minute`,`hour`,`day`,`month`,`year`]。
+如果 unit 不符合上述可选值,结果将返回语法错误。 
+### example
+
+```
+mysql> select auto_partition_name('range', 'years', '123');
+ERROR 1105 (HY000): errCode = 2, detailMessage = range auto_partition_name 
must accept year|month|day|hour|minute|second for 2nd argument
+
+mysql> select auto_partition_name('range', 'year', '2022-12-12 19:20:30');
++---------------------------------------------------------------+
+| auto_partition_name('range', 'year', '2022-12-12 19:20:30')   |
++---------------------------------------------------------------+
+| p20220101000000                                               |
++---------------------------------------------------------------+
+
+mysql> select auto_partition_name('range', 'month', '2022-12-12 19:20:30');
++---------------------------------------------------------------+
+| auto_partition_name('range', 'month', '2022-12-12 19:20:30')  |
++---------------------------------------------------------------+
+| p20221201000000                                               |
++---------------------------------------------------------------+
+
+mysql> select auto_partition_name('range', 'day', '2022-12-12 19:20:30');
++---------------------------------------------------------------+
+| auto_partition_name('range', 'day', '2022-12-12 19:20:30')    |
++---------------------------------------------------------------+
+| p20221212000000                                               |
++---------------------------------------------------------------+
+
+mysql> select auto_partition_name('range', 'hour', '2022-12-12 19:20:30');
++---------------------------------------------------------------+
+| auto_partition_name('range', 'hour', '2022-12-12 19:20:30')   |
++---------------------------------------------------------------+
+| p20221212190000                                               |
++---------------------------------------------------------------+
+
+mysql> select auto_partition_name('range', 'minute', '2022-12-12 19:20:30');
++---------------------------------------------------------------+
+| auto_partition_name('range', 'minute', '2022-12-12 19:20:30') |
++---------------------------------------------------------------+
+| p20221212192000                                               |
++---------------------------------------------------------------+
+
+mysql> select auto_partition_name('range', 'second', '2022-12-12 19:20:30');
++---------------------------------------------------------------+
+| auto_partition_name('range', 'second', '2022-12-12 19:20:30') |
++---------------------------------------------------------------+
+| p20221212192030                                               |
++---------------------------------------------------------------+
+
+mysql> select auto_partition_name('list', 'helloworld');
++-------------------------------------------+
+| auto_partition_name('list', 'helloworld') |
++-------------------------------------------+
+| phelloworld10                             |
++-------------------------------------------+
+
+mysql> select auto_partition_name('list', 'hello', 'world');
++-----------------------------------------------+
+| auto_partition_name('list', 'hello', 'world') |
++-----------------------------------------------+
+| phello5world5                                 |
++-----------------------------------------------+
+
+mysql> select auto_partition_name('list', "你好");
++------------------------------------+
+| auto_partition_name('list', "你好") |
++------------------------------------+
+| p4f60597d2                         |
++------------------------------------+
+
+```
+
+### keywords
+
+    AUTO_PARTITION_NAME,AUTO,PARTITION,NAME
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/string-functions/auto_partition_name.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/string-functions/auto_partition_name.md
new file mode 100644
index 0000000000..f904019b8b
--- /dev/null
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/version-3.0/sql-manual/sql-functions/string-functions/auto_partition_name.md
@@ -0,0 +1,128 @@
+---
+{
+    "title": "auto_partition_name",
+    "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.
+-->
+
+## auto_partition_name
+
+<version since="3.0.1"> 
+
+auto_partition_name
+
+</version>
+
+### description
+
+:::info 备注
+自 3.0.1 开始支持 auto_partition_name 用法
+:::
+
+#### Syntax
+
+`VARCHAR AUTO_PARTITION_NAME('RANGE', 'VARCHAR unit', DATETIME datetime)`
+
+`VARCHAR AUTO_PARTITION_NAME('LIST', VARCHAR,...)`
+
+遵循 RANGE 的分区名规则将 datetime 按照 unit 生成分区名
+
+遵循 LIST 的分区名规则将字符串转换为分区名
+
+datetime 参数是合法的日期表达式。
+
+unit 参数是您希望的时间间隔,可选的值如下:[`second`,`minute`,`hour`,`day`,`month`,`year`]。
+如果 unit 不符合上述可选值,结果将返回语法错误。 
+### example
+
+```
+mysql> select auto_partition_name('range', 'years', '123');
+ERROR 1105 (HY000): errCode = 2, detailMessage = range auto_partition_name 
must accept year|month|day|hour|minute|second for 2nd argument
+
+mysql> select auto_partition_name('range', 'year', '2022-12-12 19:20:30');
++---------------------------------------------------------------+
+| auto_partition_name('range', 'year', '2022-12-12 19:20:30')   |
++---------------------------------------------------------------+
+| p20220101000000                                               |
++---------------------------------------------------------------+
+
+mysql> select auto_partition_name('range', 'month', '2022-12-12 19:20:30');
++---------------------------------------------------------------+
+| auto_partition_name('range', 'month', '2022-12-12 19:20:30')  |
++---------------------------------------------------------------+
+| p20221201000000                                               |
++---------------------------------------------------------------+
+
+mysql> select auto_partition_name('range', 'day', '2022-12-12 19:20:30');
++---------------------------------------------------------------+
+| auto_partition_name('range', 'day', '2022-12-12 19:20:30')    |
++---------------------------------------------------------------+
+| p20221212000000                                               |
++---------------------------------------------------------------+
+
+mysql> select auto_partition_name('range', 'hour', '2022-12-12 19:20:30');
++---------------------------------------------------------------+
+| auto_partition_name('range', 'hour', '2022-12-12 19:20:30')   |
++---------------------------------------------------------------+
+| p20221212190000                                               |
++---------------------------------------------------------------+
+
+mysql> select auto_partition_name('range', 'minute', '2022-12-12 19:20:30');
++---------------------------------------------------------------+
+| auto_partition_name('range', 'minute', '2022-12-12 19:20:30') |
++---------------------------------------------------------------+
+| p20221212192000                                               |
++---------------------------------------------------------------+
+
+mysql> select auto_partition_name('range', 'second', '2022-12-12 19:20:30');
++---------------------------------------------------------------+
+| auto_partition_name('range', 'second', '2022-12-12 19:20:30') |
++---------------------------------------------------------------+
+| p20221212192030                                               |
++---------------------------------------------------------------+
+
+mysql> select auto_partition_name('list', 'helloworld');
++-------------------------------------------+
+| auto_partition_name('list', 'helloworld') |
++-------------------------------------------+
+| phelloworld10                             |
++-------------------------------------------+
+
+mysql> select auto_partition_name('list', 'hello', 'world');
++-----------------------------------------------+
+| auto_partition_name('list', 'hello', 'world') |
++-----------------------------------------------+
+| phello5world5                                 |
++-----------------------------------------------+
+
+mysql> select auto_partition_name('list', "你好");
++------------------------------------+
+| auto_partition_name('list', "你好") |
++------------------------------------+
+| p4f60597d2                         |
++------------------------------------+
+
+```
+
+### keywords
+
+    AUTO_PARTITION_NAME,AUTO,PARTITION,NAME
diff --git a/sidebars.json b/sidebars.json
index 9057d6036b..57a05ad0fa 100644
--- a/sidebars.json
+++ b/sidebars.json
@@ -772,6 +772,7 @@
                                 
"sql-manual/sql-functions/string-functions/to-base64",
                                 
"sql-manual/sql-functions/string-functions/from-base64",
                                 
"sql-manual/sql-functions/string-functions/ascii",
+                                
"sql-manual/sql-functions/string-functions/auto_partition_name",
                                 
"sql-manual/sql-functions/string-functions/length",
                                 
"sql-manual/sql-functions/string-functions/bit-length",
                                 
"sql-manual/sql-functions/string-functions/char-length",
@@ -1622,4 +1623,4 @@
             ]
         }
     ]
-}
+}
\ No newline at end of file
diff --git 
a/versioned_docs/version-2.1/sql-manual/sql-functions/string-functions/auto_partition_name.md
 
b/versioned_docs/version-2.1/sql-manual/sql-functions/string-functions/auto_partition_name.md
new file mode 100644
index 0000000000..c9b1dd0421
--- /dev/null
+++ 
b/versioned_docs/version-2.1/sql-manual/sql-functions/string-functions/auto_partition_name.md
@@ -0,0 +1,116 @@
+---
+{
+    "title": "AUTO_PARTITION_NAME",
+    "language": "en"
+}
+---
+
+<!-- 
+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.
+-->
+
+## auto_partition_name
+### description
+#### Syntax
+
+`VARCHAR AUTO_PARTITION_NAME('RANGE', 'VARCHAR unit', DATETIME datetime)`
+
+`VARCHAR AUTO_PARTITION_NAME('LIST', VARCHAR,...)`
+
+Generate datetime partition names by unit following RANGE's partition name 
rules
+
+Convert strings to partition names following LIST's partition name rules
+
+The datetime parameter is a legal date expression.
+
+The unit parameter is the time interval you want, the available values are: 
[`second`, `minute`, `hour`, `day`, `month`, `year`].
+If unit does not match one of these options, a syntax error will be returned. 
+### example
+
+```
+mysql> select auto_partition_name('range', 'years', '123');
+ERROR 1105 (HY000): errCode = 2, detailMessage = range auto_partition_name 
must accept year|month|day|hour|minute|second for 2nd argument
+
+mysql> select auto_partition_name('range', 'year', '2022-12-12 19:20:30');
++---------------------------------------------------------------+
+| auto_partition_name('range', 'year', '2022-12-12 19:20:30')   |
++---------------------------------------------------------------+
+| p20220101000000                                               |
++---------------------------------------------------------------+
+
+mysql> select auto_partition_name('range', 'month', '2022-12-12 19:20:30');
++---------------------------------------------------------------+
+| auto_partition_name('range', 'month', '2022-12-12 19:20:30')  |
++---------------------------------------------------------------+
+| p20221201000000                                               |
++---------------------------------------------------------------+
+
+mysql> select auto_partition_name('range', 'day', '2022-12-12 19:20:30');
++---------------------------------------------------------------+
+| auto_partition_name('range', 'day', '2022-12-12 19:20:30')    |
++---------------------------------------------------------------+
+| p20221212000000                                               |
++---------------------------------------------------------------+
+
+mysql> select auto_partition_name('range', 'hour', '2022-12-12 19:20:30');
++---------------------------------------------------------------+
+| auto_partition_name('range', 'hour', '2022-12-12 19:20:30')   |
++---------------------------------------------------------------+
+| p20221212190000                                               |
++---------------------------------------------------------------+
+
+mysql> select auto_partition_name('range', 'minute', '2022-12-12 19:20:30');
++---------------------------------------------------------------+
+| auto_partition_name('range', 'minute', '2022-12-12 19:20:30') |
++---------------------------------------------------------------+
+| p20221212192000                                               |
++---------------------------------------------------------------+
+
+mysql> select auto_partition_name('range', 'second', '2022-12-12 19:20:30');
++---------------------------------------------------------------+
+| auto_partition_name('range', 'second', '2022-12-12 19:20:30') |
++---------------------------------------------------------------+
+| p20221212192030                                               |
++---------------------------------------------------------------+
+
+mysql> select auto_partition_name('list', 'helloworld');
++-------------------------------------------+
+| auto_partition_name('list', 'helloworld') |
++-------------------------------------------+
+| phelloworld10                             |
++-------------------------------------------+
+
+mysql> select auto_partition_name('list', 'hello', 'world');
++-----------------------------------------------+
+| auto_partition_name('list', 'hello', 'world') |
++-----------------------------------------------+
+| phello5world5                                 |
++-----------------------------------------------+
+
+mysql> select auto_partition_name('list', "你好");
++------------------------------------+
+| auto_partition_name('list', "你好") |
++------------------------------------+
+| p4f60597d2                         |
++------------------------------------+
+
+```
+
+### keywords
+
+    AUTO_PARTITION_NAME,AUTO,PARTITION,NAME
diff --git 
a/versioned_docs/version-3.0/sql-manual/sql-functions/string-functions/auto_partition_name.md
 
b/versioned_docs/version-3.0/sql-manual/sql-functions/string-functions/auto_partition_name.md
new file mode 100644
index 0000000000..c9b1dd0421
--- /dev/null
+++ 
b/versioned_docs/version-3.0/sql-manual/sql-functions/string-functions/auto_partition_name.md
@@ -0,0 +1,116 @@
+---
+{
+    "title": "AUTO_PARTITION_NAME",
+    "language": "en"
+}
+---
+
+<!-- 
+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.
+-->
+
+## auto_partition_name
+### description
+#### Syntax
+
+`VARCHAR AUTO_PARTITION_NAME('RANGE', 'VARCHAR unit', DATETIME datetime)`
+
+`VARCHAR AUTO_PARTITION_NAME('LIST', VARCHAR,...)`
+
+Generate datetime partition names by unit following RANGE's partition name 
rules
+
+Convert strings to partition names following LIST's partition name rules
+
+The datetime parameter is a legal date expression.
+
+The unit parameter is the time interval you want, the available values are: 
[`second`, `minute`, `hour`, `day`, `month`, `year`].
+If unit does not match one of these options, a syntax error will be returned. 
+### example
+
+```
+mysql> select auto_partition_name('range', 'years', '123');
+ERROR 1105 (HY000): errCode = 2, detailMessage = range auto_partition_name 
must accept year|month|day|hour|minute|second for 2nd argument
+
+mysql> select auto_partition_name('range', 'year', '2022-12-12 19:20:30');
++---------------------------------------------------------------+
+| auto_partition_name('range', 'year', '2022-12-12 19:20:30')   |
++---------------------------------------------------------------+
+| p20220101000000                                               |
++---------------------------------------------------------------+
+
+mysql> select auto_partition_name('range', 'month', '2022-12-12 19:20:30');
++---------------------------------------------------------------+
+| auto_partition_name('range', 'month', '2022-12-12 19:20:30')  |
++---------------------------------------------------------------+
+| p20221201000000                                               |
++---------------------------------------------------------------+
+
+mysql> select auto_partition_name('range', 'day', '2022-12-12 19:20:30');
++---------------------------------------------------------------+
+| auto_partition_name('range', 'day', '2022-12-12 19:20:30')    |
++---------------------------------------------------------------+
+| p20221212000000                                               |
++---------------------------------------------------------------+
+
+mysql> select auto_partition_name('range', 'hour', '2022-12-12 19:20:30');
++---------------------------------------------------------------+
+| auto_partition_name('range', 'hour', '2022-12-12 19:20:30')   |
++---------------------------------------------------------------+
+| p20221212190000                                               |
++---------------------------------------------------------------+
+
+mysql> select auto_partition_name('range', 'minute', '2022-12-12 19:20:30');
++---------------------------------------------------------------+
+| auto_partition_name('range', 'minute', '2022-12-12 19:20:30') |
++---------------------------------------------------------------+
+| p20221212192000                                               |
++---------------------------------------------------------------+
+
+mysql> select auto_partition_name('range', 'second', '2022-12-12 19:20:30');
++---------------------------------------------------------------+
+| auto_partition_name('range', 'second', '2022-12-12 19:20:30') |
++---------------------------------------------------------------+
+| p20221212192030                                               |
++---------------------------------------------------------------+
+
+mysql> select auto_partition_name('list', 'helloworld');
++-------------------------------------------+
+| auto_partition_name('list', 'helloworld') |
++-------------------------------------------+
+| phelloworld10                             |
++-------------------------------------------+
+
+mysql> select auto_partition_name('list', 'hello', 'world');
++-----------------------------------------------+
+| auto_partition_name('list', 'hello', 'world') |
++-----------------------------------------------+
+| phello5world5                                 |
++-----------------------------------------------+
+
+mysql> select auto_partition_name('list', "你好");
++------------------------------------+
+| auto_partition_name('list', "你好") |
++------------------------------------+
+| p4f60597d2                         |
++------------------------------------+
+
+```
+
+### keywords
+
+    AUTO_PARTITION_NAME,AUTO,PARTITION,NAME
diff --git a/versioned_sidebars/version-2.1-sidebars.json 
b/versioned_sidebars/version-2.1-sidebars.json
index ec7d39b808..a31792b1c6 100644
--- a/versioned_sidebars/version-2.1-sidebars.json
+++ b/versioned_sidebars/version-2.1-sidebars.json
@@ -731,6 +731,7 @@
                                 
"sql-manual/sql-functions/string-functions/to-base64",
                                 
"sql-manual/sql-functions/string-functions/from-base64",
                                 
"sql-manual/sql-functions/string-functions/ascii",
+                                
"sql-manual/sql-functions/string-functions/auto_partition_name",
                                 
"sql-manual/sql-functions/string-functions/length",
                                 
"sql-manual/sql-functions/string-functions/bit-length",
                                 
"sql-manual/sql-functions/string-functions/char-length",
@@ -1541,4 +1542,4 @@
             ]
         }
     ]
-}
+}
\ No newline at end of file
diff --git a/versioned_sidebars/version-3.0-sidebars.json 
b/versioned_sidebars/version-3.0-sidebars.json
index 162b13aab1..078da0ed75 100644
--- a/versioned_sidebars/version-3.0-sidebars.json
+++ b/versioned_sidebars/version-3.0-sidebars.json
@@ -759,6 +759,7 @@
                                 
"sql-manual/sql-functions/string-functions/to-base64",
                                 
"sql-manual/sql-functions/string-functions/from-base64",
                                 
"sql-manual/sql-functions/string-functions/ascii",
+                                
"sql-manual/sql-functions/string-functions/auto_partition_name",
                                 
"sql-manual/sql-functions/string-functions/length",
                                 
"sql-manual/sql-functions/string-functions/bit-length",
                                 
"sql-manual/sql-functions/string-functions/char-length",
@@ -1559,4 +1560,4 @@
             ]
         }
     ]
-}
+}
\ No newline at end of file


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


Reply via email to