This is an automated email from the ASF dual-hosted git repository.
github-bot pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion.git
The following commit(s) were added to refs/heads/main by this push:
new c2d839f594 chore: refactor array fn signatures & add more slt tests
(#17672)
c2d839f594 is described below
commit c2d839f594e3d68005bf24ab02138343137349fa
Author: Jeffrey Vo <[email protected]>
AuthorDate: Sun Sep 21 09:00:21 2025 +1000
chore: refactor array fn signatures & add more slt tests (#17672)
---
datafusion/functions-nested/src/array_has.rs | 4 +-
datafusion/functions-nested/src/cardinality.rs | 6 -
datafusion/functions-nested/src/flatten.rs | 16 +--
datafusion/functions-nested/src/length.rs | 31 +++--
datafusion/functions-nested/src/remove.rs | 16 ++-
datafusion/functions-nested/src/resize.rs | 4 +-
datafusion/functions-nested/src/reverse.rs | 2 +-
datafusion/sqllogictest/test_files/array.slt | 174 ++++++++++++++++++++++++-
8 files changed, 216 insertions(+), 37 deletions(-)
diff --git a/datafusion/functions-nested/src/array_has.rs
b/datafusion/functions-nested/src/array_has.rs
index af9000fd75..a6375808b1 100644
--- a/datafusion/functions-nested/src/array_has.rs
+++ b/datafusion/functions-nested/src/array_has.rs
@@ -497,7 +497,7 @@ impl Default for ArrayHasAll {
impl ArrayHasAll {
pub fn new() -> Self {
Self {
- signature: Signature::any(2, Volatility::Immutable),
+ signature: Signature::arrays(2, None, Volatility::Immutable),
aliases: vec![String::from("list_has_all")],
}
}
@@ -571,7 +571,7 @@ impl Default for ArrayHasAny {
impl ArrayHasAny {
pub fn new() -> Self {
Self {
- signature: Signature::any(2, Volatility::Immutable),
+ signature: Signature::arrays(2, None, Volatility::Immutable),
aliases: vec![String::from("list_has_any"),
String::from("arrays_overlap")],
}
}
diff --git a/datafusion/functions-nested/src/cardinality.rs
b/datafusion/functions-nested/src/cardinality.rs
index 1f0f508c6d..6db0011cd0 100644
--- a/datafusion/functions-nested/src/cardinality.rs
+++ b/datafusion/functions-nested/src/cardinality.rs
@@ -58,7 +58,6 @@ impl Cardinality {
],
Volatility::Immutable,
),
- aliases: vec![],
}
}
}
@@ -83,7 +82,6 @@ impl Cardinality {
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct Cardinality {
signature: Signature,
- aliases: Vec<String>,
}
impl Default for Cardinality {
@@ -114,10 +112,6 @@ impl ScalarUDFImpl for Cardinality {
make_scalar_function(cardinality_inner)(&args.args)
}
- fn aliases(&self) -> &[String] {
- &self.aliases
- }
-
fn documentation(&self) -> Option<&Documentation> {
self.doc()
}
diff --git a/datafusion/functions-nested/src/flatten.rs
b/datafusion/functions-nested/src/flatten.rs
index 413b28aa80..1b74af643c 100644
--- a/datafusion/functions-nested/src/flatten.rs
+++ b/datafusion/functions-nested/src/flatten.rs
@@ -25,11 +25,9 @@ use arrow::datatypes::{
DataType::{FixedSizeList, LargeList, List, Null},
};
use datafusion_common::cast::{as_large_list_array, as_list_array};
-use datafusion_common::utils::ListCoercion;
use datafusion_common::{exec_err, utils::take_function_args, Result};
use datafusion_expr::{
- ArrayFunctionArgument, ArrayFunctionSignature, ColumnarValue,
Documentation,
- ScalarUDFImpl, Signature, TypeSignature, Volatility,
+ ColumnarValue, Documentation, ScalarUDFImpl, Signature, Volatility,
};
use datafusion_macros::user_doc;
use std::any::Any;
@@ -75,15 +73,7 @@ impl Default for Flatten {
impl Flatten {
pub fn new() -> Self {
Self {
- signature: Signature {
- type_signature: TypeSignature::ArraySignature(
- ArrayFunctionSignature::Array {
- arguments: vec![ArrayFunctionArgument::Array],
- array_coercion:
Some(ListCoercion::FixedSizedListToList),
- },
- ),
- volatility: Volatility::Immutable,
- },
+ signature: Signature::array(Volatility::Immutable),
aliases: vec![],
}
}
@@ -104,7 +94,7 @@ impl ScalarUDFImpl for Flatten {
fn return_type(&self, arg_types: &[DataType]) -> Result<DataType> {
let data_type = match &arg_types[0] {
- List(field) | FixedSizeList(field, _) => match field.data_type() {
+ List(field) => match field.data_type() {
List(field) | FixedSizeList(field, _) =>
List(Arc::clone(field)),
_ => arg_types[0].clone(),
},
diff --git a/datafusion/functions-nested/src/length.rs
b/datafusion/functions-nested/src/length.rs
index 90e7fcc047..060a978185 100644
--- a/datafusion/functions-nested/src/length.rs
+++ b/datafusion/functions-nested/src/length.rs
@@ -29,9 +29,10 @@ use arrow::datatypes::{
use datafusion_common::cast::{
as_fixed_size_list_array, as_generic_list_array, as_int64_array,
};
-use datafusion_common::{exec_err, plan_err, Result};
+use datafusion_common::{exec_err, Result};
use datafusion_expr::{
- ColumnarValue, Documentation, ScalarUDFImpl, Signature, Volatility,
+ ArrayFunctionArgument, ArrayFunctionSignature, ColumnarValue,
Documentation,
+ ScalarUDFImpl, Signature, TypeSignature, Volatility,
};
use datafusion_functions::downcast_arg;
use datafusion_macros::user_doc;
@@ -79,7 +80,22 @@ impl Default for ArrayLength {
impl ArrayLength {
pub fn new() -> Self {
Self {
- signature: Signature::variadic_any(Volatility::Immutable),
+ signature: Signature::one_of(
+ vec![
+
TypeSignature::ArraySignature(ArrayFunctionSignature::Array {
+ arguments: vec![ArrayFunctionArgument::Array],
+ array_coercion: None,
+ }),
+
TypeSignature::ArraySignature(ArrayFunctionSignature::Array {
+ arguments: vec![
+ ArrayFunctionArgument::Array,
+ ArrayFunctionArgument::Index,
+ ],
+ array_coercion: None,
+ }),
+ ],
+ Volatility::Immutable,
+ ),
aliases: vec![String::from("list_length")],
}
}
@@ -97,13 +113,8 @@ impl ScalarUDFImpl for ArrayLength {
&self.signature
}
- fn return_type(&self, arg_types: &[DataType]) -> Result<DataType> {
- Ok(match arg_types[0] {
- List(_) | LargeList(_) | FixedSizeList(_, _) => UInt64,
- _ => {
- return plan_err!("The array_length function can only accept
List/LargeList/FixedSizeList.");
- }
- })
+ fn return_type(&self, _arg_types: &[DataType]) -> Result<DataType> {
+ Ok(UInt64)
}
fn invoke_with_args(
diff --git a/datafusion/functions-nested/src/remove.rs
b/datafusion/functions-nested/src/remove.rs
index 5445808413..d330606cdd 100644
--- a/datafusion/functions-nested/src/remove.rs
+++ b/datafusion/functions-nested/src/remove.rs
@@ -26,9 +26,11 @@ use arrow::array::{
use arrow::buffer::OffsetBuffer;
use arrow::datatypes::{DataType, Field};
use datafusion_common::cast::as_int64_array;
+use datafusion_common::utils::ListCoercion;
use datafusion_common::{exec_err, utils::take_function_args, Result};
use datafusion_expr::{
- ColumnarValue, Documentation, ScalarUDFImpl, Signature, Volatility,
+ ArrayFunctionArgument, ArrayFunctionSignature, ColumnarValue,
Documentation,
+ ScalarUDFImpl, Signature, TypeSignature, Volatility,
};
use datafusion_macros::user_doc;
use std::any::Any;
@@ -156,7 +158,17 @@ pub(super) struct ArrayRemoveN {
impl ArrayRemoveN {
pub fn new() -> Self {
Self {
- signature: Signature::any(3, Volatility::Immutable),
+ signature: Signature::new(
+ TypeSignature::ArraySignature(ArrayFunctionSignature::Array {
+ arguments: vec![
+ ArrayFunctionArgument::Array,
+ ArrayFunctionArgument::Element,
+ ArrayFunctionArgument::Index,
+ ],
+ array_coercion: Some(ListCoercion::FixedSizedListToList),
+ }),
+ Volatility::Immutable,
+ ),
aliases: vec!["list_remove_n".to_string()],
}
}
diff --git a/datafusion/functions-nested/src/resize.rs
b/datafusion/functions-nested/src/resize.rs
index c5af3db00a..09f67a75fd 100644
--- a/datafusion/functions-nested/src/resize.rs
+++ b/datafusion/functions-nested/src/resize.rs
@@ -26,7 +26,7 @@ use arrow::buffer::OffsetBuffer;
use arrow::datatypes::DataType;
use arrow::datatypes::{ArrowNativeType, Field};
use arrow::datatypes::{
- DataType::{FixedSizeList, LargeList, List},
+ DataType::{LargeList, List},
FieldRef,
};
use datafusion_common::cast::{as_int64_array, as_large_list_array,
as_list_array};
@@ -125,7 +125,7 @@ impl ScalarUDFImpl for ArrayResize {
fn return_type(&self, arg_types: &[DataType]) -> Result<DataType> {
match &arg_types[0] {
- List(field) | FixedSizeList(field, _) =>
Ok(List(Arc::clone(field))),
+ List(field) => Ok(List(Arc::clone(field))),
LargeList(field) => Ok(LargeList(Arc::clone(field))),
DataType::Null => {
Ok(List(Arc::new(Field::new_list_field(DataType::Int64,
true))))
diff --git a/datafusion/functions-nested/src/reverse.rs
b/datafusion/functions-nested/src/reverse.rs
index 35ee312945..8440d890d2 100644
--- a/datafusion/functions-nested/src/reverse.rs
+++ b/datafusion/functions-nested/src/reverse.rs
@@ -76,7 +76,7 @@ impl Default for ArrayReverse {
impl ArrayReverse {
pub fn new() -> Self {
Self {
- signature: Signature::any(1, Volatility::Immutable),
+ signature: Signature::array(Volatility::Immutable),
aliases: vec!["list_reverse".to_string()],
}
}
diff --git a/datafusion/sqllogictest/test_files/array.slt
b/datafusion/sqllogictest/test_files/array.slt
index 75cf13aae0..77c7f7ccfc 100644
--- a/datafusion/sqllogictest/test_files/array.slt
+++ b/datafusion/sqllogictest/test_files/array.slt
@@ -1521,6 +1521,11 @@ select input, array_max(input) from (select make_array(d
- 1, d, d + 1) input fr
[29, 30, 31] 31
[NULL, NULL, NULL] NULL
+query II
+select array_max(arrow_cast(make_array(1, 2, 3), 'LargeList(Int64)')),
array_max(arrow_cast(make_array(1), 'LargeList(Int64)'));
+----
+3 1
+
query II
select array_max(arrow_cast(make_array(1, 2, 3), 'FixedSizeList(3, Int64)')),
array_max(arrow_cast(make_array(1), 'FixedSizeList(1, Int64)'));
----
@@ -1606,6 +1611,11 @@ select input, array_min(input) from (select make_array(d
- 1, d, d + 1) input fr
[29, 30, 31] 29
[NULL, NULL, NULL] NULL
+query II
+select array_min(arrow_cast(make_array(1, 2, 3), 'LargeList(Int64)')),
array_min(arrow_cast(make_array(1), 'LargeList(Int64)'));
+----
+1 1
+
query II
select array_min(arrow_cast(make_array(1, 2, 3), 'FixedSizeList(3, Int64)')),
array_min(arrow_cast(make_array(1), 'FixedSizeList(1, Int64)'));
----
@@ -2802,7 +2812,6 @@ select array_append(column1, arrow_cast(make_array(1, 11,
111), 'FixedSizeList(3
# DuckDB: [4]
# ClickHouse: Null
-# Since they dont have the same result, we just follow Postgres, return error
query ?
select array_prepend(4, NULL);
----
@@ -3222,6 +3231,22 @@ select array_concat(
----
[1, 2, 3]
+query ?
+select array_concat(
+ arrow_cast(['1', '2'], 'LargeList(Utf8)'),
+ arrow_cast(['3'], 'LargeList(Utf8)')
+);
+----
+[1, 2, 3]
+
+query ?
+select array_concat(
+ arrow_cast(['1', '2'], 'FixedSizeList(2, Utf8)'),
+ arrow_cast(['3'], 'FixedSizeList(1, Utf8)')
+);
+----
+[1, 2, 3]
+
# Concatenating string arrays
query ?
select array_concat(
@@ -3845,6 +3870,14 @@ select
----
[1, 3, 3, 4] [1, 0, 4, 5, 4, 6, 7] [1, 2, 3]
+query ???
+select
+ array_replace(arrow_cast(make_array(1, 2, 3, 4), 'FixedSizeList(4, Int64)'),
2, 3),
+ array_replace(arrow_cast(make_array(1, 4, 4, 5, 4, 6, 7), 'FixedSizeList(7,
Int64)'), 4, 0),
+ array_replace(arrow_cast(make_array(1, 2, 3), 'FixedSizeList(3, Int64)'), 4,
0);
+----
+[1, 3, 3, 4] [1, 0, 4, 5, 4, 6, 7] [1, 2, 3]
+
# array_replace scalar function #2 (element is list)
query ??
select
@@ -3876,6 +3909,21 @@ select
----
[[1, 2, 3], [1, 1, 1], [5, 5, 5], [4, 5, 6], [7, 8, 9]] [[1, 3, 2], [3, 1, 4],
[2, 3, 4], [5, 3, 1], [1, 3, 2]]
+query ??
+select
+ array_replace(
+ arrow_cast(make_array([1, 2, 3], [4, 5, 6], [5, 5, 5], [4, 5, 6], [7, 8,
9]), 'FixedSizeList(5, FixedSizeList(3, Int64))'),
+ [4, 5, 6],
+ [1, 1, 1]
+ ),
+ array_replace(
+ arrow_cast(make_array([1, 3, 2], [2, 3, 4], [2, 3, 4], [5, 3, 1], [1, 3,
2]), 'FixedSizeList(5, FixedSizeList(3, Int64))'),
+ [2, 3, 4],
+ [3, 1, 4]
+ );
+----
+[[1, 2, 3], [1, 1, 1], [5, 5, 5], [4, 5, 6], [7, 8, 9]] [[1, 3, 2], [3, 1, 4],
[2, 3, 4], [5, 3, 1], [1, 3, 2]]
+
# list_replace scalar function #3 (function alias `list_replace`)
query ???
select list_replace(
@@ -4017,6 +4065,14 @@ select
----
[1, 3, 3, 4] [1, 0, 0, 5, 4, 6, 7] [1, 2, 3]
+query ???
+select
+ array_replace_n(arrow_cast(make_array(1, 2, 3, 4), 'FixedSizeList(4,
Int64)'), 2, 3, 2),
+ array_replace_n(arrow_cast(make_array(1, 4, 4, 5, 4, 6, 7),
'FixedSizeList(7, Int64)'), 4, 0, 2),
+ array_replace_n(arrow_cast(make_array(1, 2, 3), 'FixedSizeList(3, Int64)'),
4, 0, 3);
+----
+[1, 3, 3, 4] [1, 0, 0, 5, 4, 6, 7] [1, 2, 3]
+
# array_replace_n scalar function #2 (element is list)
query ??
select
@@ -4052,6 +4108,23 @@ select
----
[[1, 2, 3], [1, 1, 1], [5, 5, 5], [1, 1, 1], [7, 8, 9]] [[1, 3, 2], [3, 1, 4],
[3, 1, 4], [5, 3, 1], [1, 3, 2]]
+query ??
+select
+ array_replace_n(
+ arrow_cast(make_array([1, 2, 3], [4, 5, 6], [5, 5, 5], [4, 5, 6], [7, 8,
9]), 'FixedSizeList(5, FixedSizeList(3, Int64))'),
+ [4, 5, 6],
+ [1, 1, 1],
+ 2
+ ),
+ array_replace_n(
+ arrow_cast(make_array([1, 3, 2], [2, 3, 4], [2, 3, 4], [5, 3, 1], [1, 3,
2]), 'FixedSizeList(5, FixedSizeList(3, Int64))'),
+ [2, 3, 4],
+ [3, 1, 4],
+ 2
+ );
+----
+[[1, 2, 3], [1, 1, 1], [5, 5, 5], [1, 1, 1], [7, 8, 9]] [[1, 3, 2], [3, 1, 4],
[3, 1, 4], [5, 3, 1], [1, 3, 2]]
+
# list_replace_n scalar function #3 (function alias `array_replace_n`)
query ???
select
@@ -4208,6 +4281,14 @@ select
----
[1, 3, 3, 4] [1, 0, 0, 5, 0, 6, 7] [1, 2, 3]
+query ???
+select
+ array_replace_all(arrow_cast(make_array(1, 2, 3, 4), 'FixedSizeList(4,
Int64)'), 2, 3),
+ array_replace_all(arrow_cast(make_array(1, 4, 4, 5, 4, 6, 7),
'FixedSizeList(7, Int64)'), 4, 0),
+ array_replace_all(arrow_cast(make_array(1, 2, 3), 'FixedSizeList(3,
Int64)'), 4, 0);
+----
+[1, 3, 3, 4] [1, 0, 0, 5, 0, 6, 7] [1, 2, 3]
+
# array_replace_all scalar function #2 (element is list)
query ??
select
@@ -4239,6 +4320,21 @@ select
----
[[1, 2, 3], [1, 1, 1], [5, 5, 5], [1, 1, 1], [7, 8, 9]] [[1, 3, 2], [3, 1, 4],
[3, 1, 4], [5, 3, 1], [1, 3, 2]]
+query ??
+select
+ array_replace_all(
+ arrow_cast(make_array([1, 2, 3], [4, 5, 6], [5, 5, 5], [4, 5, 6], [7, 8,
9]), 'FixedSizeList(5, FixedSizeList(3, Int64))'),
+ [4, 5, 6],
+ [1, 1, 1]
+ ),
+ array_replace_all(
+ arrow_cast(make_array([1, 3, 2], [2, 3, 4], [2, 3, 4], [5, 3, 1], [1, 3,
2]), 'FixedSizeList(5, FixedSizeList(3, Int64))'),
+ [2, 3, 4],
+ [3, 1, 4]
+ );
+----
+[[1, 2, 3], [1, 1, 1], [5, 5, 5], [1, 1, 1], [7, 8, 9]] [[1, 3, 2], [3, 1, 4],
[3, 1, 4], [5, 3, 1], [1, 3, 2]]
+
# list_replace_all scalar function #3 (function alias `array_replace_all`)
query ???
select
@@ -4504,6 +4600,16 @@ select array_union(arrow_cast([1, 2, 3, 4],
'LargeList(Int64)'), arrow_cast([5,
----
[1, 2, 3, 4, 5, 6]
+query ?
+select array_union(arrow_cast([1, 2, 3, 4], 'FixedSizeList(4, Int64)'),
arrow_cast([5, 6, 3, 4], 'FixedSizeList(4, Int64)'));
+----
+[1, 2, 3, 4, 5, 6]
+
+query ?
+select array_union(arrow_cast([1, 2, 3, 4], 'FixedSizeList(4, Int64)'),
arrow_cast([5, 6], 'FixedSizeList(2, Int64)'));
+----
+[1, 2, 3, 4, 5, 6]
+
# array_union scalar function #2
query ?
select array_union([1, 2, 3, 4], [5, 6, 7, 8]);
@@ -4979,6 +5085,12 @@ select array_remove(arrow_cast(make_array([1, 2, 3], [4,
5, 6], [5, 5, 5], [4, 5
----
[[1, 2, 3], [5, 5, 5], [4, 5, 6], [7, 8, 9]] [[1, 3, 2], [2, 3, 4], [5, 3, 1],
[1, 3, 2]]
+query ??
+select array_remove(arrow_cast(make_array([1, 2, 3], [4, 5, 6], [5, 5, 5], [4,
5, 6], [7, 8, 9]), 'FixedSizeList(5, FixedSizeList(3, Int64))'), [4, 5, 6]),
+ array_remove(arrow_cast(make_array([1, 3, 2], [2, 3, 4], [2, 3, 4], [5,
3, 1], [1, 3, 2]), 'FixedSizeList(5, FixedSizeList(3, Int64))'), [2, 3, 4]);
+----
+[[1, 2, 3], [5, 5, 5], [4, 5, 6], [7, 8, 9]] [[1, 3, 2], [2, 3, 4], [5, 3, 1],
[1, 3, 2]]
+
# list_remove scalar function #3 (function alias `array_remove`)
query ???
select list_remove(make_array(1, 2, 2, 1, 1), 2), list_remove(make_array(1.0,
2.0, 2.0, 1.0, 1.0), 1.0), list_remove(make_array('h', 'e', 'l', 'l', 'o'),
'l');
@@ -5102,12 +5214,38 @@ select array_remove_n(make_array(1, 2, 2, 1, 1), 2, 2),
array_remove_n(make_arra
----
[1, 1, 1] [2.0, 2.0, 1.0] [h, e, o]
+query ???
+select array_remove_n(arrow_cast(make_array(1, 2, 2, 1, 1),
'LargeList(Int32)'), 2, 2),
+ array_remove_n(arrow_cast(make_array(1.0, 2.0, 2.0, 1.0, 1.0),
'LargeList(Float32)'), 1.0, 2),
+ array_remove_n(arrow_cast(make_array('h', 'e', 'l', 'l', 'o'),
'LargeList(Utf8)'), 'l', 3);
+----
+[1, 1, 1] [2.0, 2.0, 1.0] [h, e, o]
+
+query ???
+select array_remove_n(arrow_cast(make_array(1, 2, 2, 1, 1), 'FixedSizeList(5,
Int32)'), 2, 2),
+ array_remove_n(arrow_cast(make_array(1.0, 2.0, 2.0, 1.0, 1.0),
'FixedSizeList(5, Float32)'), 1.0, 2),
+ array_remove_n(arrow_cast(make_array('h', 'e', 'l', 'l', 'o'),
'FixedSizeList(5, Utf8)'), 'l', 3);
+----
+[1, 1, 1] [2.0, 2.0, 1.0] [h, e, o]
+
# array_remove_n scalar function #2 (element is list)
query ??
select array_remove_n(make_array([1, 2, 3], [4, 5, 6], [5, 5, 5], [4, 5, 6],
[7, 8, 9]), [4, 5, 6], 2), array_remove_n(make_array([1, 3, 2], [2, 3, 4], [2,
3, 4], [5, 3, 1], [1, 3, 2]), [2, 3, 4], 2);
----
[[1, 2, 3], [5, 5, 5], [7, 8, 9]] [[1, 3, 2], [5, 3, 1], [1, 3, 2]]
+query ??
+select array_remove_n(arrow_cast(make_array([1, 2, 3], [4, 5, 6], [5, 5, 5],
[4, 5, 6], [7, 8, 9]), 'LargeList(List(Int64))'), [4, 5, 6], 2),
+ array_remove_n(arrow_cast(make_array([1, 3, 2], [2, 3, 4], [2, 3, 4],
[5, 3, 1], [1, 3, 2]), 'LargeList(List(Int64))'), [2, 3, 4], 2);
+----
+[[1, 2, 3], [5, 5, 5], [7, 8, 9]] [[1, 3, 2], [5, 3, 1], [1, 3, 2]]
+
+query ??
+select array_remove_n(arrow_cast(make_array([1, 2, 3], [4, 5, 6], [5, 5, 5],
[4, 5, 6], [7, 8, 9]), 'FixedSizeList(5, FixedSizeList(3, Int64))'), [4, 5, 6],
2),
+ array_remove_n(arrow_cast(make_array([1, 3, 2], [2, 3, 4], [2, 3, 4],
[5, 3, 1], [1, 3, 2]), 'FixedSizeList(5, FixedSizeList(3, Int64))'), [2, 3, 4],
2);
+----
+[[1, 2, 3], [5, 5, 5], [7, 8, 9]] [[1, 3, 2], [5, 3, 1], [1, 3, 2]]
+
# list_remove_n scalar function #3 (function alias `array_remove_n`)
query ???
select list_remove_n(make_array(1, 2, 2, 1, 1), 2, 2),
list_remove_n(make_array(1.0, 2.0, 2.0, 1.0, 1.0), 1.0, 2),
list_remove_n(make_array('h', 'e', 'l', 'l', 'o'), 'l', 3);
@@ -5170,6 +5308,13 @@ select array_remove_all(make_array(1, 2, 2, 1, 1), 2),
array_remove_all(make_arr
----
[1, 1, 1] [2.0, 2.0] [h, e, o]
+query ???
+select array_remove_all(arrow_cast(make_array(1, 2, 2, 1, 1),
'LargeList(Int64)'), 2),
+ array_remove_all(arrow_cast(make_array(1.0, 2.0, 2.0, 1.0, 1.0),
'LargeList(Float64)'), 1.0),
+ array_remove_all(arrow_cast(make_array('h', 'e', 'l', 'l', 'o'),
'LargeList(Utf8)'), 'l');
+----
+[1, 1, 1] [2.0, 2.0] [h, e, o]
+
query ???
select array_remove_all(arrow_cast(make_array(1, 2, 2, 1, 1),
'FixedSizeList(5, Int64)'), 2), array_remove_all(arrow_cast(make_array(1.0,
2.0, 2.0, 1.0, 1.0), 'FixedSizeList(5, Float64)'), 1.0),
array_remove_all(arrow_cast(make_array('h', 'e', 'l', 'l', 'o'),
'FixedSizeList(5, Utf8)'), 'l');
----
@@ -5187,6 +5332,12 @@ select array_remove_all(arrow_cast(make_array([1, 2, 3],
[4, 5, 6], [5, 5, 5], [
----
[[1, 2, 3], [5, 5, 5], [7, 8, 9]] [[1, 3, 2], [5, 3, 1], [1, 3, 2]]
+query ??
+select array_remove_all(arrow_cast(make_array([1, 2, 3], [4, 5, 6], [5, 5, 5],
[4, 5, 6], [7, 8, 9]), 'FixedSizeList(5, FixedSizeList(3, Int64))'), [4, 5, 6]),
+ array_remove_all(arrow_cast(make_array([1, 3, 2], [2, 3, 4], [2, 3, 4],
[5, 3, 1], [1, 3, 2]), 'FixedSizeList(5, FixedSizeList(3, Int64))'), [2, 3,
4]);
+----
+[[1, 2, 3], [5, 5, 5], [7, 8, 9]] [[1, 3, 2], [5, 3, 1], [1, 3, 2]]
+
# list_remove_all scalar function #3 (function alias `array_remove_all`)
query ???
select list_remove_all(make_array(1, 2, 2, 1, 1), 2),
list_remove_all(make_array(1.0, 2.0, 2.0, 1.0, 1.0), 1.0),
list_remove_all(make_array('h', 'e', 'l', 'l', 'o'), 'l');
@@ -6622,6 +6773,17 @@ SELECT array_intersect(arrow_cast(make_array(1,2,3),
'LargeList(Int64)'), arrow
----
[2, 3] [] [aa, cc] [true] [2.2, 3.3] [[2, 2], [3, 3]]
+query ??????
+SELECT array_intersect(arrow_cast(make_array(1,2,3), 'FixedSizeList(3,
Int64)'), arrow_cast(make_array(2,3,4), 'FixedSizeList(3, Int64)')),
+ array_intersect(arrow_cast(make_array(1,3,5), 'FixedSizeList(3,
Int64)'), arrow_cast(make_array(2,4,6), 'FixedSizeList(3, Int64)')),
+ array_intersect(arrow_cast(make_array('aa','bb','cc'),
'FixedSizeList(3, Utf8)'), arrow_cast(make_array('cc','aa','dd'),
'FixedSizeList(3, Utf8)')),
+ array_intersect(arrow_cast(make_array(true, false), 'FixedSizeList(2,
Boolean)'), arrow_cast(make_array(true), 'FixedSizeList(1, Boolean)')),
+ array_intersect(arrow_cast(make_array(1.1, 2.2, 3.3),
'FixedSizeList(3, Float64)'), arrow_cast(make_array(2.2, 3.3, 4.4),
'FixedSizeList(3, Float64)')),
+ array_intersect(arrow_cast(make_array([1, 1], [2, 2], [3, 3]),
'FixedSizeList(3, List(Int64))'), arrow_cast(make_array([2, 2], [3, 3], [4,
4]), 'FixedSizeList(3, List(Int64))'))
+;
+----
+[2, 3] [] [aa, cc] [true] [2.2, 3.3] [[2, 2], [3, 3]]
+
query ?
select array_intersect([], []);
----
@@ -7872,6 +8034,11 @@ select array_resize(arrow_cast(make_array(1, 2, 3),
'LargeList(Int64)'), 1);
----
[1]
+query ?
+select array_resize(arrow_cast(make_array(1, 2, 3), 'FixedSizeList(3,
Int64)'), 1);
+----
+[1]
+
# array_resize scalar function #2
query ?
select array_resize(make_array(1, 2, 3), 5);
@@ -7883,6 +8050,11 @@ select array_resize(arrow_cast(make_array(1, 2, 3),
'LargeList(Int64)'), 5);
----
[1, 2, 3, NULL, NULL]
+query ?
+select array_resize(arrow_cast(make_array(1, 2, 3), 'FixedSizeList(3,
Int64)'), 5);
+----
+[1, 2, 3, NULL, NULL]
+
# array_resize scalar function #3
query ?
select array_resize(make_array(1, 2, 3), 5, 4);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]