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 fcc87efabd [feat] add docs of new functions array_split, 
array_reverse_split (#698)
fcc87efabd is described below

commit fcc87efabdfe3c4b09a2eaae7960b3b169258db3
Author: zclllyybb <zhaochan...@selectdb.com>
AuthorDate: Thu Jun 6 10:18:26 2024 +0800

    [feat] add docs of new functions array_split, array_reverse_split (#698)
    
    master pr: https://github.com/apache/doris/pull/35619
---
 .../array-functions/array-reverse-split.md         | 79 ++++++++++++++++++++++
 .../sql-functions/array-functions/array-split.md   | 79 ++++++++++++++++++++++
 .../array-functions/array-reverse-split.md         | 79 ++++++++++++++++++++++
 .../sql-functions/array-functions/array-split.md   | 79 ++++++++++++++++++++++
 sidebars.json                                      |  2 +
 5 files changed, 318 insertions(+)

diff --git 
a/docs/sql-manual/sql-functions/array-functions/array-reverse-split.md 
b/docs/sql-manual/sql-functions/array-functions/array-reverse-split.md
new file mode 100644
index 0000000000..e1b365f37b
--- /dev/null
+++ b/docs/sql-manual/sql-functions/array-functions/array-reverse-split.md
@@ -0,0 +1,79 @@
+---
+{
+    "title": "ARRAY_REVERSE_SPLIT",
+    "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.
+-->
+
+## array_sortby
+
+array_reverse_split
+
+### description
+
+#### Syntax
+
+```sql
+ARRAY<ARRAY<T>> array_reverse_split(ARRAY<T> arg, Array<Boolean> cond)
+ARRAY<ARRAY<T>> array_reverse_split(lambda, ARRAY<T0> arg0...)
+```
+
+1. pass in two `ARRAY` of equal length, the second of which is an 
`Array<Boolean>`, and split the `arg` according to the split point to the right 
of the position in the `cond` that is `true`.
+2. Higher-order functions, passed a lambda expression and at least one `ARRAY 
arg0`, split `arg0` by the right-hand side of the `true` position in the `cond` 
of the `Array<Boolean>` result of the operation on the lambda expression.
+
+### example
+
+```
+mysql> select array_reverse_split([1,2,3,4,5], [1,0,1,0,0]);
++-------------------------------------------------------------------------------+
+| array_reverse_split([1, 2, 3, 4, 5], cast([1, 0, 1, 0, 0] as 
ARRAY<BOOLEAN>)) |
++-------------------------------------------------------------------------------+
+| [[1], [2, 3], [4, 5]]                                                        
 |
++-------------------------------------------------------------------------------+
+1 row in set (0.12 sec)
+
+mysql> select array_reverse_split((x,y)->y, [1,2,3,4,5], [1,0,0,0,0]);
++------------------------------------------------------------------------------------------------------------------------+
+| array_reverse_split([1, 2, 3, 4, 5], cast(array_map((x, y) -> y, [1, 2, 3, 
4, 5], [1, 0, 0, 0, 0]) as ARRAY<BOOLEAN>)) |
++------------------------------------------------------------------------------------------------------------------------+
+| [[1], [2, 3, 4, 5]]                                                          
                                          |
++------------------------------------------------------------------------------------------------------------------------+
+1 row in set (0.13 sec)
+
+mysql> select array_reverse_split((x,y)->(y+1), ['a', 'b', 'c', 'd'], [-1, -1, 
0, -1]);
++----------------------------------------------------------------------------------------------------------------------------------------+
+| array_reverse_split(['a', 'b', 'c', 'd'], cast(array_map((x, y) -> (y + 1), 
['a', 'b', 'c', 'd'], [-1, -1, 0, -1]) as ARRAY<BOOLEAN>)) |
++----------------------------------------------------------------------------------------------------------------------------------------+
+| [["a", "b", "c"], ["d"]]                                                     
                                                          |
++----------------------------------------------------------------------------------------------------------------------------------------+
+1 row in set (0.13 sec)
+
+mysql> select array_reverse_split(x->(year(x)>2013),["2020-12-12", 
"2013-12-12", "2015-12-12", null]);
++---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+| array_reverse_split(['2020-12-12', '2013-12-12', '2015-12-12', NULL], 
array_map(x -> (year(cast(x as DATEV2)) > 2013), ['2020-12-12', '2013-12-12', 
'2015-12-12', NULL])) |
++---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+| [["2020-12-12"], ["2013-12-12", "2015-12-12"], [null]]                       
                                                                                
             |
++---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+1 row in set (0.14 sec)
+```
+
+### keywords
+
+ARRAY, REVERSE, SPLIT, ARRAY_REVERSE_SPLIT
diff --git a/docs/sql-manual/sql-functions/array-functions/array-split.md 
b/docs/sql-manual/sql-functions/array-functions/array-split.md
new file mode 100644
index 0000000000..094a2de8e2
--- /dev/null
+++ b/docs/sql-manual/sql-functions/array-functions/array-split.md
@@ -0,0 +1,79 @@
+---
+{
+    "title": "ARRAY_SPLIT",
+    "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.
+-->
+
+## array_sortby
+
+array_split
+
+### description
+
+#### Syntax
+
+```sql
+ARRAY<ARRAY<T>> array_split(ARRAY<T> arg, Array<Boolean> cond)
+ARRAY<ARRAY<T>> array_split(lambda, ARRAY<T0> arg0...)
+```
+
+1. pass in two `ARRAY` of equal length, the second of which is an 
`Array<Boolean>`, and split the `arg` according to the split point to the left 
of the position in the `cond` where `true` is found.
+2. Higher-order functions, passed a lambda expression and at least one `ARRAY 
arg0`, split `arg0` by the left-hand side of the `true` position in the 
`Array<Boolean>` result of the lambda expression operation.
+
+### example
+
+```
+mysql> select array_split([1,2,3,4,5], [1,0,1,0,0]);
++-----------------------------------------------------------------------+
+| array_split([1, 2, 3, 4, 5], cast([1, 0, 1, 0, 0] as ARRAY<BOOLEAN>)) |
++-----------------------------------------------------------------------+
+| [[1, 2], [3, 4, 5]]                                                   |
++-----------------------------------------------------------------------+
+1 row in set (0.09 sec)
+
+mysql> select array_split((x,y)->y, [1,2,3,4,5], [1,0,0,0,0]);
++----------------------------------------------------------------------------------------------------------------+
+| array_split([1, 2, 3, 4, 5], cast(array_map((x, y) -> y, [1, 2, 3, 4, 5], 
[1, 0, 0, 0, 0]) as ARRAY<BOOLEAN>)) |
++----------------------------------------------------------------------------------------------------------------+
+| [[1, 2, 3, 4, 5]]                                                            
                                  |
++----------------------------------------------------------------------------------------------------------------+
+1 row in set (0.13 sec)
+
+mysql> select array_split((x,y)->(y+1), ['a', 'b', 'c', 'd'], [-1, -1, 0, -1]);
++--------------------------------------------------------------------------------------------------------------------------------+
+| array_split(['a', 'b', 'c', 'd'], cast(array_map((x, y) -> (y + 1), ['a', 
'b', 'c', 'd'], [-1, -1, 0, -1]) as ARRAY<BOOLEAN>)) |
++--------------------------------------------------------------------------------------------------------------------------------+
+| [["a", "b"], ["c", "d"]]                                                     
                                                  |
++--------------------------------------------------------------------------------------------------------------------------------+
+1 row in set (0.12 sec)
+
+mysql> select array_split(x->(year(x)>2013),["2020-12-12", "2013-12-12", 
"2015-12-12", null]);
++-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+| array_split(['2020-12-12', '2013-12-12', '2015-12-12', NULL], array_map(x -> 
(year(cast(x as DATEV2)) > 2013), ['2020-12-12', '2013-12-12', '2015-12-12', 
NULL])) |
++-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+| [["2020-12-12", "2013-12-12"], ["2015-12-12"], [null]]                       
                                                                                
     |
++-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+1 row in set (0.14 sec)
+```
+
+### keywords
+
+ARRAY, SPLIT, ARRAY_SPLIT
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/array-functions/array-reverse-split.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/array-functions/array-reverse-split.md
new file mode 100644
index 0000000000..c7dc402f1f
--- /dev/null
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/array-functions/array-reverse-split.md
@@ -0,0 +1,79 @@
+---
+{
+    "title": "ARRAY_REVERSE_SPLIT",
+    "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.
+-->
+
+## array_sortby
+
+array_reverse_split
+
+### description
+
+#### Syntax
+
+```sql
+ARRAY<ARRAY<T>> array_reverse_split(ARRAY<T> arg, Array<Boolean> cond)
+ARRAY<ARRAY<T>> array_reverse_split(lambda, ARRAY<T0> arg0...)
+```
+
+1. 传入两个长度相等的 `ARRAY` 且第二个为 `Array<Boolean>`,按照 `cond` 中为 `true` 的位置右侧作为分割点,分割 
`arg` 。
+2. 高阶函数,传入一个 lambda 表达式和至少一个 `ARRAY arg0`,则按照 lambda 表达式运算得到的 `Array<Boolean>` 
结果,其中为 `true` 的位置右侧作为分割点,分割 `arg0` 。
+
+### example
+
+```
+mysql> select array_reverse_split([1,2,3,4,5], [1,0,1,0,0]);
++-------------------------------------------------------------------------------+
+| array_reverse_split([1, 2, 3, 4, 5], cast([1, 0, 1, 0, 0] as 
ARRAY<BOOLEAN>)) |
++-------------------------------------------------------------------------------+
+| [[1], [2, 3], [4, 5]]                                                        
 |
++-------------------------------------------------------------------------------+
+1 row in set (0.12 sec)
+
+mysql> select array_reverse_split((x,y)->y, [1,2,3,4,5], [1,0,0,0,0]);
++------------------------------------------------------------------------------------------------------------------------+
+| array_reverse_split([1, 2, 3, 4, 5], cast(array_map((x, y) -> y, [1, 2, 3, 
4, 5], [1, 0, 0, 0, 0]) as ARRAY<BOOLEAN>)) |
++------------------------------------------------------------------------------------------------------------------------+
+| [[1], [2, 3, 4, 5]]                                                          
                                          |
++------------------------------------------------------------------------------------------------------------------------+
+1 row in set (0.13 sec)
+
+mysql> select array_reverse_split((x,y)->(y+1), ['a', 'b', 'c', 'd'], [-1, -1, 
0, -1]);
++----------------------------------------------------------------------------------------------------------------------------------------+
+| array_reverse_split(['a', 'b', 'c', 'd'], cast(array_map((x, y) -> (y + 1), 
['a', 'b', 'c', 'd'], [-1, -1, 0, -1]) as ARRAY<BOOLEAN>)) |
++----------------------------------------------------------------------------------------------------------------------------------------+
+| [["a", "b", "c"], ["d"]]                                                     
                                                          |
++----------------------------------------------------------------------------------------------------------------------------------------+
+1 row in set (0.13 sec)
+
+mysql> select array_reverse_split(x->(year(x)>2013),["2020-12-12", 
"2013-12-12", "2015-12-12", null]);
++---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+| array_reverse_split(['2020-12-12', '2013-12-12', '2015-12-12', NULL], 
array_map(x -> (year(cast(x as DATEV2)) > 2013), ['2020-12-12', '2013-12-12', 
'2015-12-12', NULL])) |
++---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+| [["2020-12-12"], ["2013-12-12", "2015-12-12"], [null]]                       
                                                                                
             |
++---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+1 row in set (0.14 sec)
+```
+
+### keywords
+
+ARRAY, REVERSE, SPLIT, ARRAY_REVERSE_SPLIT
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/array-functions/array-split.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/array-functions/array-split.md
new file mode 100644
index 0000000000..aa771a709f
--- /dev/null
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/array-functions/array-split.md
@@ -0,0 +1,79 @@
+---
+{
+    "title": "ARRAY_SPLIT",
+    "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.
+-->
+
+## array_sortby
+
+array_split
+
+### description
+
+#### Syntax
+
+```sql
+ARRAY<ARRAY<T>> array_split(ARRAY<T> arg, Array<Boolean> cond)
+ARRAY<ARRAY<T>> array_split(lambda, ARRAY<T0> arg0...)
+```
+
+1. 传入两个长度相等的 `ARRAY` 且第二个为 `Array<Boolean>`,则按照 `cond` 中为 `true` 的位置左侧作为分割点,分割 
`arg` 。
+2. 高阶函数,传入一个 lambda 表达式和至少一个 `ARRAY arg0`,则按照 lambda 表达式运算得到的 `Array<Boolean>` 
结果,其中为 `true` 的位置左侧作为分割点,分割 `arg0` 。
+
+### example
+
+```
+mysql> select array_split([1,2,3,4,5], [1,0,1,0,0]);
++-----------------------------------------------------------------------+
+| array_split([1, 2, 3, 4, 5], cast([1, 0, 1, 0, 0] as ARRAY<BOOLEAN>)) |
++-----------------------------------------------------------------------+
+| [[1, 2], [3, 4, 5]]                                                   |
++-----------------------------------------------------------------------+
+1 row in set (0.09 sec)
+
+mysql> select array_split((x,y)->y, [1,2,3,4,5], [1,0,0,0,0]);
++----------------------------------------------------------------------------------------------------------------+
+| array_split([1, 2, 3, 4, 5], cast(array_map((x, y) -> y, [1, 2, 3, 4, 5], 
[1, 0, 0, 0, 0]) as ARRAY<BOOLEAN>)) |
++----------------------------------------------------------------------------------------------------------------+
+| [[1, 2, 3, 4, 5]]                                                            
                                  |
++----------------------------------------------------------------------------------------------------------------+
+1 row in set (0.13 sec)
+
+mysql> select array_split((x,y)->(y+1), ['a', 'b', 'c', 'd'], [-1, -1, 0, -1]);
++--------------------------------------------------------------------------------------------------------------------------------+
+| array_split(['a', 'b', 'c', 'd'], cast(array_map((x, y) -> (y + 1), ['a', 
'b', 'c', 'd'], [-1, -1, 0, -1]) as ARRAY<BOOLEAN>)) |
++--------------------------------------------------------------------------------------------------------------------------------+
+| [["a", "b"], ["c", "d"]]                                                     
                                                  |
++--------------------------------------------------------------------------------------------------------------------------------+
+1 row in set (0.12 sec)
+
+mysql> select array_split(x->(year(x)>2013),["2020-12-12", "2013-12-12", 
"2015-12-12", null]);
++-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+| array_split(['2020-12-12', '2013-12-12', '2015-12-12', NULL], array_map(x -> 
(year(cast(x as DATEV2)) > 2013), ['2020-12-12', '2013-12-12', '2015-12-12', 
NULL])) |
++-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+| [["2020-12-12", "2013-12-12"], ["2015-12-12"], [null]]                       
                                                                                
     |
++-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+1 row in set (0.14 sec)
+```
+
+### keywords
+
+ARRAY, SPLIT, ARRAY_SPLIT
diff --git a/sidebars.json b/sidebars.json
index 49db7b45bc..e705bf5468 100644
--- a/sidebars.json
+++ b/sidebars.json
@@ -549,6 +549,8 @@
                                 
"sql-manual/sql-functions/array-functions/array-sort",
                                 
"sql-manual/sql-functions/array-functions/array-reverse-sort",
                                 
"sql-manual/sql-functions/array-functions/array-sortby",
+                                
"sql-manual/sql-functions/array-functions/array-split",
+                                
"sql-manual/sql-functions/array-functions/array-reverse-split",
                                 
"sql-manual/sql-functions/array-functions/array-position",
                                 
"sql-manual/sql-functions/array-functions/array-contains",
                                 
"sql-manual/sql-functions/array-functions/array-except",


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

Reply via email to