This is an automated email from the ASF dual-hosted git repository.
dataroaring pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 360d3050bc [Feature](array-function) Support array_reverse_sort
function (#17754)
360d3050bc is described below
commit 360d3050bce4cdd9c30e8187a928e58594395c7f
Author: ZhangYu0123 <[email protected]>
AuthorDate: Sat Mar 25 21:58:11 2023 +0800
[Feature](array-function) Support array_reverse_sort function (#17754)
Co-authored-by: zhangyu209 <[email protected]>
---
be/src/vec/functions/array/function_array_sort.cpp | 10 ++-
be/src/vec/functions/array/function_array_sort.h | 58 +++++++++++----
.../array-functions/array_reverse_sort.md | 84 ++++++++++++++++++++++
docs/sidebars.json | 1 +
.../array-functions/array_reverse_sort.md | 84 ++++++++++++++++++++++
.../apache/doris/analysis/FunctionCallExpr.java | 2 +
gensrc/script/doris_builtins_functions.py | 19 +++++
.../array_functions/test_array_functions.out | 33 +++++++++
.../test_array_functions_by_literal.out | 33 +++++++++
.../array_functions/test_array_functions.groovy | 3 +
.../test_array_functions_by_literal.groovy | 13 ++++
11 files changed, 324 insertions(+), 16 deletions(-)
diff --git a/be/src/vec/functions/array/function_array_sort.cpp
b/be/src/vec/functions/array/function_array_sort.cpp
index 932cc2a1f0..e1688d7471 100644
--- a/be/src/vec/functions/array/function_array_sort.cpp
+++ b/be/src/vec/functions/array/function_array_sort.cpp
@@ -21,8 +21,16 @@
namespace doris::vectorized {
+struct NameArraySort {
+ static constexpr auto name = "array_sort";
+};
+struct NameArrayReverseSort {
+ static constexpr auto name = "array_reverse_sort";
+};
+
void register_function_array_sort(SimpleFunctionFactory& factory) {
- factory.register_function<FunctionArraySort>();
+ factory.register_function<FunctionArraySort<NameArraySort, true>>();
+ factory.register_function<FunctionArraySort<NameArrayReverseSort,
false>>();
}
} // namespace doris::vectorized
\ No newline at end of file
diff --git a/be/src/vec/functions/array/function_array_sort.h
b/be/src/vec/functions/array/function_array_sort.h
index 0f72093bd2..5938a8df34 100644
--- a/be/src/vec/functions/array/function_array_sort.h
+++ b/be/src/vec/functions/array/function_array_sort.h
@@ -26,10 +26,11 @@
namespace doris::vectorized {
+template <typename Name, bool Positive>
class FunctionArraySort : public IFunction {
public:
- static constexpr auto name = "array_sort";
- static FunctionPtr create() { return
std::make_shared<FunctionArraySort>(); }
+ static constexpr auto name = Name::name;
+ static FunctionPtr create() { return
std::make_shared<FunctionArraySort<Name, Positive>>(); }
using NullMapType = PaddedPODArray<UInt8>;
/// Get function name.
@@ -115,10 +116,11 @@ private:
}
int result = src_data_concrete->compare_at(permutation[j],
permutation[k],
src_column, 1);
- if (result > 0) {
- auto temp = permutation[j];
- permutation[j] = permutation[k];
- permutation[k] = temp;
+
+ if (Positive && result > 0) {
+ std::swap(permutation[j], permutation[k]);
+ } else if (!Positive && result < 0) {
+ std::swap(permutation[j], permutation[k]);
}
}
}
@@ -147,14 +149,20 @@ private:
for (auto curr_src_offset : src_offsets) {
// filter and insert null element first
+ size_t null_element_count = 0;
for (size_t j = prev_src_offset; j < curr_src_offset; ++j) {
if (src_null_map && (*src_null_map)[j]) {
- DCHECK(dest_null_map != nullptr);
- (*dest_null_map).push_back(true);
- dest_datas.push_back(NestType());
+ ++null_element_count;
}
}
+ // positive sort, insert null elements first
+ if (Positive && null_element_count > 0) {
+ DCHECK(dest_null_map != nullptr);
+ (*dest_null_map).add_num_element_without_reserve(true,
null_element_count);
+ dest_datas.add_num_element_without_reserve(NestType(),
null_element_count);
+ }
+
_sort_by_permutation<ColumnType>(prev_src_offset, curr_src_offset,
src_data_concrete,
src_column, src_null_map,
permutation);
@@ -169,6 +177,14 @@ private:
(*dest_null_map).push_back(false);
}
}
+
+ // not positive sort, insert null elements last
+ if (!Positive && null_element_count > 0) {
+ DCHECK(dest_null_map != nullptr);
+ (*dest_null_map).add_num_element_without_reserve(true,
null_element_count);
+ dest_datas.add_num_element_without_reserve(NestType(),
null_element_count);
+ }
+
dest_offsets.push_back(curr_src_offset);
prev_src_offset = curr_src_offset;
}
@@ -196,12 +212,14 @@ private:
}
for (auto curr_src_offset : src_offsets) {
- // filter and insert null element first
- for (size_t j = prev_src_offset; j < curr_src_offset; ++j) {
- if (src_null_map && (*src_null_map)[j]) {
- DCHECK(dest_null_map != nullptr);
-
column_string_offsets.push_back(column_string_offsets.back());
- (*dest_null_map).push_back(true);
+ // Positive sort, filter and insert null element first
+ if (Positive) {
+ for (size_t j = prev_src_offset; j < curr_src_offset; ++j) {
+ if (src_null_map && (*src_null_map)[j]) {
+ DCHECK(dest_null_map != nullptr);
+
column_string_offsets.push_back(column_string_offsets.back());
+ (*dest_null_map).push_back(true);
+ }
}
}
@@ -229,6 +247,16 @@ private:
(*dest_null_map).push_back(false);
}
}
+ // not Positive sort, filter and insert null element last
+ if (!Positive) {
+ for (size_t j = prev_src_offset; j < curr_src_offset; ++j) {
+ if (src_null_map && (*src_null_map)[j]) {
+ DCHECK(dest_null_map != nullptr);
+
column_string_offsets.push_back(column_string_offsets.back());
+ (*dest_null_map).push_back(true);
+ }
+ }
+ }
dest_offsets.push_back(curr_src_offset);
prev_src_offset = curr_src_offset;
}
diff --git
a/docs/en/docs/sql-manual/sql-functions/array-functions/array_reverse_sort.md
b/docs/en/docs/sql-manual/sql-functions/array-functions/array_reverse_sort.md
new file mode 100644
index 0000000000..4ff824be63
--- /dev/null
+++
b/docs/en/docs/sql-manual/sql-functions/array-functions/array_reverse_sort.md
@@ -0,0 +1,84 @@
+---
+{
+ "title": "array_reverse_sort",
+ "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_reverse_sort
+
+<version since="1.2.3">
+
+array_reverse_sort
+
+</version>
+
+### description
+
+#### Syntax
+
+```
+ARRAY<T> array_reverse_sort(ARRAY<T> arr)
+```
+
+Return the array which has been sorted in descending order. Return NULL for
NULL input.
+If the element of array is NULL, it will be placed in the last of the sorted
array.
+
+### notice
+
+`Only supported in vectorized engine`
+
+### example
+
+```
+mysql> set enable_vectorized_engine=true;
+mysql> select k1, k2, array_reverse_sort(k2) from array_test;
++------+-----------------------------+-----------------------------+
+| k1 | k2 | array_reverse_sort(`k2`) |
++------+-----------------------------+-----------------------------+
+| 1 | [1, 2, 3, 4, 5] | [5, 4, 3, 2, 1] |
+| 2 | [6, 7, 8] | [8, 7, 6] |
+| 3 | [] | [] |
+| 4 | NULL | NULL |
+| 5 | [1, 2, 3, 4, 5, 4, 3, 2, 1] | [5, 4, 4, 3, 3, 2, 2, 1, 1] |
+| 6 | [1, 2, 3, NULL] | [3, 2, 1, NULL] |
+| 7 | [1, 2, 3, NULL, NULL] | [3, 2, 1, NULL, NULL] |
+| 8 | [1, 1, 2, NULL, NULL] | [2, 1, 1, NULL, NULL] |
+| 9 | [1, NULL, 1, 2, NULL, NULL] | [2, 1, 1, NULL, NULL, NULL] |
++------+-----------------------------+-----------------------------+
+
+mysql> select k1, k2, array_reverse_sort(k2) from array_test01;
++------+------------------------------------------+------------------------------------------+
+| k1 | k2 | array_reverse_sort(`k2`)
|
++------+------------------------------------------+------------------------------------------+
+| 1 | ['a', 'b', 'c', 'd', 'e'] | ['e', 'd', 'c', 'b', 'a']
|
+| 2 | ['f', 'g', 'h'] | ['h', 'g', 'f']
|
+| 3 | [''] | ['']
|
+| 3 | [NULL] | [NULL]
|
+| 5 | ['a', 'b', 'c', 'd', 'e', 'a', 'b', 'c'] | ['e', 'd', 'c', 'c', 'b',
'b', 'a', 'a'] |
+| 6 | NULL | NULL
|
+| 7 | ['a', 'b', NULL] | ['b', 'a', NULL]
|
+| 8 | ['a', 'b', NULL, NULL] | ['b', 'a', NULL, NULL]
|
++------+------------------------------------------+------------------------------------------+
+```
+
+### keywords
+
+ARRAY, SORT, REVERSE, ARRAY_SORT, ARRAY_REVERSE_SORT
diff --git a/docs/sidebars.json b/docs/sidebars.json
index cff67c5099..79d4f2b415 100644
--- a/docs/sidebars.json
+++ b/docs/sidebars.json
@@ -282,6 +282,7 @@
"sql-manual/sql-functions/array-functions/array_remove",
"sql-manual/sql-functions/array-functions/array_slice",
"sql-manual/sql-functions/array-functions/array_sort",
+
"sql-manual/sql-functions/array-functions/array_reverse_sort",
"sql-manual/sql-functions/array-functions/array_position",
"sql-manual/sql-functions/array-functions/array_contains",
"sql-manual/sql-functions/array-functions/array_except",
diff --git
a/docs/zh-CN/docs/sql-manual/sql-functions/array-functions/array_reverse_sort.md
b/docs/zh-CN/docs/sql-manual/sql-functions/array-functions/array_reverse_sort.md
new file mode 100644
index 0000000000..77b4b7edfc
--- /dev/null
+++
b/docs/zh-CN/docs/sql-manual/sql-functions/array-functions/array_reverse_sort.md
@@ -0,0 +1,84 @@
+---
+{
+ "title": "array_reverse_sort",
+ "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_reverse_sort
+
+<version since="1.2.3">
+
+array_reverse_sort
+
+</version>
+
+### description
+
+#### Syntax
+
+```
+ARRAY<T> array_reverse_sort(ARRAY<T> arr)
+```
+
+返回按降序排列后的数组,如果输入数组为NULL,则返回NULL。
+如果数组元素包含NULL, 则输出的排序数组会将NULL放在最后面。
+
+### notice
+
+`仅支持向量化引擎中使用`
+
+### example
+
+```
+mysql> set enable_vectorized_engine=true;
+mysql> select k1, k2, array_reverse_sort(k2) from array_test;
++------+-----------------------------+-----------------------------+
+| k1 | k2 | array_reverse_sort(`k2`) |
++------+-----------------------------+-----------------------------+
+| 1 | [1, 2, 3, 4, 5] | [5, 4, 3, 2, 1] |
+| 2 | [6, 7, 8] | [8, 7, 6] |
+| 3 | [] | [] |
+| 4 | NULL | NULL |
+| 5 | [1, 2, 3, 4, 5, 4, 3, 2, 1] | [5, 4, 4, 3, 3, 2, 2, 1, 1] |
+| 6 | [1, 2, 3, NULL] | [3, 2, 1, NULL] |
+| 7 | [1, 2, 3, NULL, NULL] | [3, 2, 1, NULL, NULL] |
+| 8 | [1, 1, 2, NULL, NULL] | [2, 1, 1, NULL, NULL] |
+| 9 | [1, NULL, 1, 2, NULL, NULL] | [2, 1, 1, NULL, NULL, NULL] |
++------+-----------------------------+-----------------------------+
+
+mysql> select k1, k2, array_reverse_sort(k2) from array_test01;
++------+------------------------------------------+------------------------------------------+
+| k1 | k2 | array_reverse_sort(`k2`)
|
++------+------------------------------------------+------------------------------------------+
+| 1 | ['a', 'b', 'c', 'd', 'e'] | ['e', 'd', 'c', 'b', 'a']
|
+| 2 | ['f', 'g', 'h'] | ['h', 'g', 'f']
|
+| 3 | [''] | ['']
|
+| 3 | [NULL] | [NULL]
|
+| 5 | ['a', 'b', 'c', 'd', 'e', 'a', 'b', 'c'] | ['e', 'd', 'c', 'c', 'b',
'b', 'a', 'a'] |
+| 6 | NULL | NULL
|
+| 7 | ['a', 'b', NULL] | ['b', 'a', NULL]
|
+| 8 | ['a', 'b', NULL, NULL] | ['b', 'a', NULL, NULL]
|
++------+------------------------------------------+------------------------------------------+
+```
+
+### keywords
+
+ARRAY, SORT, REVERSE, ARRAY_SORT, ARRAY_REVERSE_SORT
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java
index cfb85e8b86..1c6e47da1c 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java
@@ -1449,6 +1449,7 @@ public class FunctionCallExpr extends Expr {
continue;
} else if
((fnName.getFunction().equalsIgnoreCase("array_distinct") ||
fnName.getFunction()
.equalsIgnoreCase("array_remove") ||
fnName.getFunction().equalsIgnoreCase("array_sort")
+ ||
fnName.getFunction().equalsIgnoreCase("array_reverse_sort")
||
fnName.getFunction().equalsIgnoreCase("array_overlap")
|| fnName.getFunction().equalsIgnoreCase("array_union")
||
fnName.getFunction().equalsIgnoreCase("array_intersect")
@@ -1562,6 +1563,7 @@ public class FunctionCallExpr extends Expr {
}
} else if (fnName.getFunction().equalsIgnoreCase("array_distinct") ||
fnName.getFunction()
.equalsIgnoreCase("array_remove") ||
fnName.getFunction().equalsIgnoreCase("array_sort")
+ || fnName.getFunction().equalsIgnoreCase("array_reverse_sort")
|| fnName.getFunction().equalsIgnoreCase("array_overlap")
|| fnName.getFunction().equalsIgnoreCase("array_union")
|| fnName.getFunction().equalsIgnoreCase("array_intersect")
diff --git a/gensrc/script/doris_builtins_functions.py
b/gensrc/script/doris_builtins_functions.py
index 0fa11adaee..503f4912ac 100644
--- a/gensrc/script/doris_builtins_functions.py
+++ b/gensrc/script/doris_builtins_functions.py
@@ -278,6 +278,25 @@ visible_functions = [
[['array_sort'], 'ARRAY_VARCHAR', ['ARRAY_VARCHAR'], ''],
[['array_sort'], 'ARRAY_STRING', ['ARRAY_STRING'], ''],
+ [['array_reverse_sort'], 'ARRAY_BOOLEAN', ['ARRAY_BOOLEAN'], ''],
+ [['array_reverse_sort'], 'ARRAY_TINYINT', ['ARRAY_TINYINT'], ''],
+ [['array_reverse_sort'], 'ARRAY_SMALLINT', ['ARRAY_SMALLINT'], ''],
+ [['array_reverse_sort'], 'ARRAY_INT', ['ARRAY_INT'], ''],
+ [['array_reverse_sort'], 'ARRAY_BIGINT', ['ARRAY_BIGINT'], ''],
+ [['array_reverse_sort'], 'ARRAY_LARGEINT', ['ARRAY_LARGEINT'], ''],
+ [['array_reverse_sort'], 'ARRAY_DATETIME', ['ARRAY_DATETIME'], ''],
+ [['array_reverse_sort'], 'ARRAY_DATE', ['ARRAY_DATE'], ''],
+ [['array_reverse_sort'], 'ARRAY_DATETIMEV2', ['ARRAY_DATETIMEV2'], ''],
+ [['array_reverse_sort'], 'ARRAY_DATEV2', ['ARRAY_DATEV2'], ''],
+ [['array_reverse_sort'], 'ARRAY_FLOAT', ['ARRAY_FLOAT'], ''],
+ [['array_reverse_sort'], 'ARRAY_DOUBLE', ['ARRAY_DOUBLE'], ''],
+ [['array_reverse_sort'], 'ARRAY_DECIMALV2', ['ARRAY_DECIMALV2'], ''],
+ [['array_reverse_sort'], 'ARRAY_DECIMAL32', ['ARRAY_DECIMAL32'], ''],
+ [['array_reverse_sort'], 'ARRAY_DECIMAL64', ['ARRAY_DECIMAL64'], ''],
+ [['array_reverse_sort'], 'ARRAY_DECIMAL128', ['ARRAY_DECIMAL128'], ''],
+ [['array_reverse_sort'], 'ARRAY_VARCHAR', ['ARRAY_VARCHAR'], ''],
+ [['array_reverse_sort'], 'ARRAY_STRING', ['ARRAY_STRING'], ''],
+
# array_join takes two params
[['array_join'], 'STRING', ['ARRAY_BOOLEAN','VARCHAR'], ''],
[['array_join'], 'STRING', ['ARRAY_TINYINT','VARCHAR'], ''],
diff --git
a/regression-test/data/query_p0/sql_functions/array_functions/test_array_functions.out
b/regression-test/data/query_p0/sql_functions/array_functions/test_array_functions.out
index 35eb15ef4b..0a8b7d6efb 100644
---
a/regression-test/data/query_p0/sql_functions/array_functions/test_array_functions.out
+++
b/regression-test/data/query_p0/sql_functions/array_functions/test_array_functions.out
@@ -175,6 +175,39 @@
8 \N
9 \N
+-- !select --
+1 [3, 2, 1] ['b', 'a', ''] [2, 1]
+2 [4] \N [5]
+3 [] [] \N
+4 [5, 4, 4, 3, 3, 2, 2, 1, 1] [] []
+5 [] ['d', 'c', 'c', 'b', 'b', 'a', 'a'] \N
+6 [5, 4, 4, 3, 3, 2, 2, 1, 1] ['d', 'c', 'c', 'b', 'b', 'a', 'a']
\N
+7 [10, 9, 8, NULL, NULL] ['h', 'g', 'f', NULL, NULL] \N
+8 [4, 4, 3, 3, 2, 1, NULL] ['b', 'b', 'b', 'a'] [3, 2, 2, 1]
+9 [3, 2, 1] ['b', 'a', ''] [2, 1]
+
+-- !select --
+1 [2023-02-06, 2023-02-05] [2022-10-15 10:30:00.999, 2022-08-31
12:00:00.999]
+2 [2023-01-06, 2023-01-05] [2022-11-15 10:30:00.999, 2022-01-31
12:00:00.999]
+3 \N \N
+4 \N \N
+5 \N \N
+6 \N \N
+7 \N \N
+8 \N \N
+9 \N \N
+
+-- !select --
+1 [222.222, 111.111]
+2 [4444.444, 3333.333]
+3 \N
+4 \N
+5 \N
+6 \N
+7 \N
+8 \N
+9 \N
+
-- !select --
1 [1, 2, 3]
2 [4, 5]
diff --git
a/regression-test/data/query_p0/sql_functions/array_functions/test_array_functions_by_literal.out
b/regression-test/data/query_p0/sql_functions/array_functions/test_array_functions_by_literal.out
index 2ad5f5550a..7de6ec5f1a 100644
---
a/regression-test/data/query_p0/sql_functions/array_functions/test_array_functions_by_literal.out
+++
b/regression-test/data/query_p0/sql_functions/array_functions/test_array_functions_by_literal.out
@@ -344,6 +344,39 @@ true
-- !sql --
[111.111, 222.222]
+-- !sql --
+[3, 2, 1]
+
+-- !sql --
+[3, 2, 1]
+
+-- !sql --
+[3, 2, 1, NULL]
+
+-- !sql --
+[3, 2, 1, NULL]
+
+-- !sql --
+['c', 'b', 'a']
+
+-- !sql --
+['c', 'b', 'a']
+
+-- !sql --
+[1, 1, 0]
+
+-- !sql --
+[]
+
+-- !sql --
+[2023-02-06 22:07:34.999, 2023-02-04 23:07:34.999]
+
+-- !sql --
+[2023-02-06, 2023-02-05]
+
+-- !sql --
+[222.222, 111.111]
+
-- !sql --
false
diff --git
a/regression-test/suites/query_p0/sql_functions/array_functions/test_array_functions.groovy
b/regression-test/suites/query_p0/sql_functions/array_functions/test_array_functions.groovy
index b0e9172b95..af1f415180 100644
---
a/regression-test/suites/query_p0/sql_functions/array_functions/test_array_functions.groovy
+++
b/regression-test/suites/query_p0/sql_functions/array_functions/test_array_functions.groovy
@@ -68,6 +68,9 @@ suite("test_array_functions") {
qt_select "SELECT k1, array_sort(k2), array_sort(k3), array_sort(k4) FROM
${tableName} ORDER BY k1"
qt_select "SELECT k1, array_sort(k8), array_sort(k10) FROM ${tableName}
ORDER BY k1"
qt_select "SELECT k1, array_sort(k12) FROM ${tableName} ORDER BY k1"
+ qt_select "SELECT k1, array_reverse_sort(k2), array_reverse_sort(k3),
array_reverse_sort(k4) FROM ${tableName} ORDER BY k1"
+ qt_select "SELECT k1, array_reverse_sort(k8), array_reverse_sort(k10) FROM
${tableName} ORDER BY k1"
+ qt_select "SELECT k1, array_reverse_sort(k12) FROM ${tableName} ORDER BY
k1"
qt_select "SELECT k1, array_union(k2, k4) FROM ${tableName} ORDER BY k1"
qt_select "SELECT k1, array_union(k8, k9) FROM ${tableName} ORDER BY k1"
qt_select "SELECT k1, array_union(k10, k11) FROM ${tableName} ORDER BY k1"
diff --git
a/regression-test/suites/query_p0/sql_functions/array_functions/test_array_functions_by_literal.groovy
b/regression-test/suites/query_p0/sql_functions/array_functions/test_array_functions_by_literal.groovy
index 7b87be7e15..32f87024c6 100644
---
a/regression-test/suites/query_p0/sql_functions/array_functions/test_array_functions_by_literal.groovy
+++
b/regression-test/suites/query_p0/sql_functions/array_functions/test_array_functions_by_literal.groovy
@@ -148,6 +148,19 @@ suite("test_array_functions_by_literal") {
qt_sql "select array_sort(array(cast ('2023-02-06' as datev2),cast
('2023-02-05' as datev2)))"
qt_sql "select array_sort(array(cast (111.111 as decimalv3(6,3)),cast
(222.222 as decimalv3(6,3))))"
+ // array_reverse_sort function
+ qt_sql "select array_reverse_sort([1,2,3])"
+ qt_sql "select array_reverse_sort([3,2,1])"
+ qt_sql "select array_reverse_sort([1,2,3,null])"
+ qt_sql "select array_reverse_sort([null,1,2,3])"
+ qt_sql "select array_reverse_sort(['a','b','c'])"
+ qt_sql "select array_reverse_sort(['c','b','a'])"
+ qt_sql "select array_reverse_sort([true, false, true])"
+ qt_sql "select array_reverse_sort([])"
+ qt_sql "select array_reverse_sort(array(cast ('2023-02-06 22:07:34.999' as
datetimev2(3)),cast ('2023-02-04 23:07:34.999' as datetimev2(3))))"
+ qt_sql "select array_reverse_sort(array(cast ('2023-02-06' as datev2),cast
('2023-02-05' as datev2)))"
+ qt_sql "select array_reverse_sort(array(cast (111.111 as
decimalv3(6,3)),cast (222.222 as decimalv3(6,3))))"
+
// array_overlap function
qt_sql "select arrays_overlap([1,2,3], [4,5,6])"
qt_sql "select arrays_overlap([1,2,3], [3,4,5])"
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]