diff --git a/datafusion/core/tests/sqllogictests/test_files/array.slt b/datafusion/core/tests/sqllogictests/test_files/array.slt index 910c5ae121638..1f17e6df29609 100644 --- a/datafusion/core/tests/sqllogictests/test_files/array.slt +++ b/datafusion/core/tests/sqllogictests/test_files/array.slt @@ -89,15 +89,29 @@ AS VALUES statement ok CREATE TABLE array_has_table_1D AS VALUES - (make_array(1, 2), 1, make_array(true, true, true), false, make_array(1,2,3), make_array(1,3)), - (make_array(3, 4, 5), 2, make_array(false, false, false), false, make_array(1,2,3,4), make_array(2,5)) + (make_array(1, 2), 1, make_array(1,2,3), make_array(1,3), make_array(1,3,5), make_array(2,4,6,8,1,3,5)), + (make_array(3, 4, 5), 2, make_array(1,2,3,4), make_array(2,5), make_array(2,4,6), make_array(1,3,5)) ; statement ok CREATE TABLE array_has_table_1D_Float AS VALUES - (make_array(1.0, 2.0), 1.0, make_array(1.0,2.0,3.0), make_array(1.0,3.0)), - (make_array(3.0, 4.0, 5.0), 2.0, make_array(1.0,2.0,3.0,4.0), make_array(2.0,5.0)) + (make_array(1.0, 2.0), 1.0, make_array(1.0,2.0,3.0), make_array(1.0,3.0), make_array(1.11), make_array(2.22, 3.33)), + (make_array(3.0, 4.0, 5.0), 2.0, make_array(1.0,2.0,3.0,4.0), make_array(2.0,5.0), make_array(2.22, 1.11), make_array(1.11, 3.33)) +; + +statement ok +CREATE TABLE array_has_table_1D_Boolean +AS VALUES + (make_array(true, true, true), false, make_array(true, true, false, true, false), make_array(true, false, true), make_array(false), make_array(true, false)), + (make_array(false, false, false), false, make_array(true, false, true), make_array(true, true), make_array(true, true), make_array(false,false,true)) +; + +statement ok +CREATE TABLE array_has_table_1D_UTF8 +AS VALUES + (make_array('a', 'bc', 'def'), 'bc', make_array('datafusion', 'rust', 'arrow'), make_array('rust', 'arrow'), make_array('rust', 'arrow', 'python'), make_array('data')), + (make_array('a', 'bc', 'def'), 'defg', make_array('datafusion', 'rust', 'arrow'), make_array('datafusion', 'rust', 'arrow', 'python'), make_array('rust', 'arrow'), make_array('datafusion', 'rust', 'arrow')) ; statement ok @@ -1051,53 +1065,71 @@ NULL 1 1 ## array_has/array_has_all/array_has_any -query BB +query BBBBBBBBB select array_has(make_array(1,2), 1), - array_has(make_array(1,2,NULL), 1) + array_has(make_array(1,2,NULL), 1), + array_has(make_array([2,3], [3,4]), make_array(2,3)), + array_has(make_array([[1], [2,3]], [[4,5], [6]]), make_array([1], [2,3])), + array_has(make_array([[1], [2,3]], [[4,5], [6]]), make_array([4,5], [6])), + array_has(make_array([[1], [2,3]], [[4,5], [6]]), make_array([1])), + array_has(make_array([[[1]]]), make_array([[1]])), + array_has(make_array([[[1]]], [[[1], [2]]]), make_array([[2]])), + array_has(make_array([[[1]]], [[[1], [2]]]), make_array([[1], [2]])) ; ---- -true true +true true true true true false true false true -query B -select array_has(make_array([2,3], [3,4]), make_array(2,3)); +query BBB +select array_has(column1, column2), + array_has_all(column3, column4), + array_has_any(column5, column6) +from array_has_table_1D; ---- -true +true true true +false false false query BBB -select array_has(make_array([[1], [2,3]], [[4,5], [6]]), make_array([1], [2,3])), - array_has(make_array([[1], [2,3]], [[4,5], [6]]), make_array([4,5], [6])), - array_has(make_array([[1], [2,3]], [[4,5], [6]]), make_array([1])); +select array_has(column1, column2), + array_has_all(column3, column4), + array_has_any(column5, column6) +from array_has_table_1D_Float; ---- true true false +false false true query BBB -select array_has(make_array([[[1]]]), make_array([[1]])), - array_has(make_array([[[1]]], [[[1], [2]]]), make_array([[2]])), - array_has(make_array([[[1]]], [[[1], [2]]]), make_array([[1], [2]])); +select array_has(column1, column2), + array_has_all(column3, column4), + array_has_any(column5, column6) +from array_has_table_1D_Boolean; ---- -true false true +false true true +true true true + +query BBB +select array_has(column1, column2), + array_has_all(column3, column4), + array_has_any(column5, column6) +from array_has_table_1D_UTF8; +---- +true true false +false false true query BB select array_has(column1, column2), - array_has(column3, column4) -from array_has_table_1D; + array_has_all(column3, column4) +from array_has_table_2D; ---- -true false false true +true false query B -select array_has(column1, column2) -from array_has_table_1D_Float; +select array_has_all(column1, column2) +from array_has_table_2D_float; ---- true false -query B -select array_has(column1, column2) from array_has_table_2D; ----- -false -true - query B select array_has(column1, column2) from array_has_table_3D; ---- @@ -1109,17 +1141,6 @@ true false true -query ??? -select column1, column2, column3 from arrays; ----- -[[, 2], [3, ]] [1.1, 2.2, 3.3] [L, o, r, e, m] -[[3, 4], [5, 6]] [, 5.5, 6.6] [i, p, , u, m] -[[5, 6], [7, 8]] [7.7, 8.8, 9.9] [d, , l, o, r] -[[7, ], [9, 10]] [10.1, , 12.2] [s, i, t] -NULL [13.3, 14.4, 15.5] [a, m, e, t] -[[11, 12], [13, 14]] NULL [,] -[[15, 16], [, 18]] [16.6, 17.7, 18.8] NULL - query BBBB select array_has(column1, make_array(5, 6)), array_has(column1, make_array(7, NULL)), @@ -1134,120 +1155,23 @@ false true false false false false false false false false false false -query BBBBBBB +query BBBBBBBBBBBBB select array_has_all(make_array(1,2,3), make_array(1,3)), array_has_all(make_array(1,2,3), make_array(1,4)), array_has_all(make_array([1,2], [3,4]), make_array([1,2])), array_has_all(make_array([1,2], [3,4]), make_array([1,3])), array_has_all(make_array([1,2], [3,4]), make_array([1,2], [3,4], [5,6])), array_has_all(make_array([[1,2,3]]), make_array([[1]])), - array_has_all(make_array([[1,2,3]]), make_array([[1,2,3]])) + array_has_all(make_array([[1,2,3]]), make_array([[1,2,3]])), + array_has_any(make_array(1,2,3), make_array(1,10,100)), + array_has_any(make_array(1,2,3), make_array(10,100)), + array_has_any(make_array([1,2], [3,4]), make_array([1,10], [10,4])), + array_has_any(make_array([1,2], [3,4]), make_array([10,20], [3,4])), + array_has_any(make_array([[1,2,3]]), make_array([[1,2,3], [4,5,6]])), + array_has_any(make_array([[1,2,3]]), make_array([[1,2,3]], [[4,5,6]])) ; ---- -true false true false false false true - -query B -select array_has_all(column5, column6) -from array_has_table_1D; ----- -true -false - -query B -select array_has_all(column3, column4) -from array_has_table_1D_Float; ----- -true -false - -query B -select array_has_all(column3, column4) -from array_has_table_2D; ----- -true -false - -query B -select array_has_all(column1, column2) -from array_has_table_2D_float; ----- -true -false - -# # array_has_all scalar function #5 -# query BB -# select array_has_all([true, true, false, true, false], [true, false, false]), array_has_all([true, false, true], [true, true]); -# ---- -# true true -# -# # array_has_all scalar function #6 -# query BBB -# select array_has_all(make_array(true, true, true), make_array(false, false)), -# array_has_all([false, false, false], [true, true]), -# array_has_all(make_array(true, true, true), make_array(true, false)); -# ---- -# false false false -# -# # For reference -# # query ?? -# # select column1, column2 from arrays; -# # ---- -# # [[, 2], [3, ]] [1.1, 2.2, 3.3] -# # [[3, 4], [5, 6]] [, 5.5, 6.6] -# # [[5, 6], [7, 8]] [7.7, 8.8, 9.9] -# # [[7, ], [9, 10]] [10.1, , 12.2] -# # NULL [13.3, 14.4, 15.5] -# # [[11, 12], [13, 14]] NULL -# # [[15, 16], [, 18]] [16.6, 17.7, 18.8] -# -# # array_has_all column-wise #1 -# query BB -# select array_has_all(column1, make_array(7)), -# array_has_all(column1, make_array(3, 4, 5, 6)) from arrays; -# ---- -# false false -# false true -# true false -# true false -# false false -# false false -# false false -# -# -# # array_has_any column-wise #1 -# query B -# select array_has_any(column1, make_array(3, 5, 7, 11)) from arrays; -# ---- -# true -# true -# true -# true -# false -# true -# false -# -# # array_has_any column-wise #2 -# query BBBBB -# select array_has_any(make_array(true, true, true), make_array(false)), -# array_has_any(make_array(true, true, true), make_array(true)), -# array_has_any(make_array(true, false), make_array(true)), -# array_has_any(make_array(true, false), make_array(false)), -# array_has_any(make_array(false, false), make_array(true, false)); -# ---- -# false true true true true -# -# # array_has_any column-wise #3 -# query BBB -# select array_has_any(column2, make_array(1.0, 1.2, 1.4)), -# array_has_any(column2, make_array(1.1, 1.2, 1.4)), -# array_has_any(column2, make_array(1.1, 16.6, 1.4)) from arrays; -# ---- -# false true true -# false false false -# false false false -# false false false -# false false false -# false false true +true false true false false false true true false false true false true ### Array operators tests ## array concatenate operator @@ -1364,6 +1288,12 @@ drop table array_has_table_1D; statement ok drop table array_has_table_1D_Float; +statement ok +drop table array_has_table_1D_Boolean; + +statement ok +drop table array_has_table_1D_UTF8; + statement ok drop table array_has_table_2D; diff --git a/datafusion/physical-expr/src/array_expressions.rs b/datafusion/physical-expr/src/array_expressions.rs index d82343133a6d4..8cdccfd8d0e77 100644 --- a/datafusion/physical-expr/src/array_expressions.rs +++ b/datafusion/physical-expr/src/array_expressions.rs @@ -1363,152 +1363,6 @@ pub fn array_ndims(args: &[ArrayRef]) -> Result { Ok(Arc::new(result) as ArrayRef) } -macro_rules! contains { - ($FIRST_ARRAY:expr, $SECOND_ARRAY:expr, $ARRAY_TYPE:ident) => {{ - let first_array = downcast_arg!($FIRST_ARRAY, $ARRAY_TYPE); - let second_array = downcast_arg!($SECOND_ARRAY, $ARRAY_TYPE); - for x in second_array.values().iter().dedup() { - if !first_array.values().contains(x) { - return Ok(false); - } - } - Ok(true) - }}; -} - -macro_rules! overlap { - ($FIRST_ARRAY:expr, $SECOND_ARRAY:expr, $ARRAY_TYPE:ident) => {{ - let first_array = downcast_arg!($FIRST_ARRAY, $ARRAY_TYPE); - let second_array = downcast_arg!($SECOND_ARRAY, $ARRAY_TYPE); - for x in second_array.values().iter().dedup() { - if first_array.values().contains(x) { - return Ok(true); - } - } - Ok(false) - }}; -} - -/// Convert nested list arry to 1d lsit array without offset preserve. -fn flatten_list_array( - array: ArrayRef, -) -> Result> { - let list_array = array.as_list::(); - match array.data_type() { - DataType::List(field) => match field.data_type() { - DataType::List(..) => { - let (_, offsets, values, _) = list_array.clone().into_parts(); - let arr_offsets = offsets.to_vec(); - let inner_arr = flatten_list_array::(values)?; - let (field, offsets, values, nulls) = inner_arr.into_parts(); - - let inner_arr_offsets = offsets.to_vec(); - let flatten_offsets: Vec = arr_offsets - .iter() - .filter_map(|idx| { - let idx = (*idx).as_usize(); - inner_arr_offsets.get(idx).cloned() - }) - .collect(); - - let offsets = OffsetBuffer::new(flatten_offsets.into()); - - let list_array = - GenericListArray::::new(field, offsets, values, nulls); - - Ok(list_array) - } - _ => Ok(list_array.clone()), - }, - _ => Err(DataFusionError::Internal( - "array should be list".to_string(), - )), - } -} - -fn overlap_internal(arr: ArrayRef, sub_arr: ArrayRef) -> Result { - match (arr.data_type(), sub_arr.data_type()) { - (DataType::Utf8, DataType::Utf8) => overlap!(arr, sub_arr, StringArray), - (DataType::LargeUtf8, DataType::LargeUtf8) => overlap!(arr, sub_arr, LargeStringArray), - (DataType::Boolean, DataType::Boolean) => { - let first_array = downcast_arg!(arr, BooleanArray); - let second_array = downcast_arg!(sub_arr, BooleanArray); - if second_array.true_count() > 0 && first_array.true_count() > 0 { - return Ok(true); - } - if second_array.false_count() > 0 &&first_array.false_count() > 0 { - return Ok(true); - } - Ok(false) - } - (DataType::Float32, DataType::Float32) => overlap!(arr, sub_arr, Float32Array), - (DataType::Float64, DataType::Float64) => overlap!(arr, sub_arr, Float64Array), - (DataType::Int8, DataType::Int8) => overlap!(arr, sub_arr, Int8Array), - (DataType::Int16, DataType::Int16) => overlap!(arr, sub_arr, Int16Array), - (DataType::Int32, DataType::Int32) => overlap!(arr, sub_arr, Int32Array), - (DataType::Int64, DataType::Int64) => overlap!(arr, sub_arr, Int64Array), - (DataType::UInt8, DataType::UInt8) => overlap!(arr, sub_arr, UInt8Array), - (DataType::UInt16, DataType::UInt16) => overlap!(arr, sub_arr, UInt16Array), - (DataType::UInt32, DataType::UInt32) => overlap!(arr, sub_arr, UInt32Array), - (DataType::UInt64, DataType::UInt64) => overlap!(arr, sub_arr, UInt64Array), - (first_array_data_type, second_array_data_type) => { - Err(DataFusionError::NotImplemented(format!( - "Array_has_all is not implemented for types '{first_array_data_type:?}' and '{second_array_data_type:?}'." - ))) - } - } -} - -fn contains_internal(arr: ArrayRef, sub_arr: ArrayRef) -> Result { - match (arr.data_type(), sub_arr.data_type()) { - (DataType::Utf8, DataType::Utf8) => contains!(arr, sub_arr, StringArray), - (DataType::LargeUtf8, DataType::LargeUtf8) => contains!(arr, sub_arr, LargeStringArray), - (DataType::Boolean, DataType::Boolean) => { - let first_array = downcast_arg!(arr, BooleanArray); - let second_array = downcast_arg!(sub_arr, BooleanArray); - if second_array.true_count() > 0 && first_array.true_count() == 0 { - return Ok(false); - } - if second_array.false_count() > 0 && first_array.false_count() == 0 { - return Ok(false); - } - Ok(true) - } - (DataType::Float32, DataType::Float32) => contains!(arr, sub_arr, Float32Array), - (DataType::Float64, DataType::Float64) => contains!(arr, sub_arr, Float64Array), - (DataType::Int8, DataType::Int8) => contains!(arr, sub_arr, Int8Array), - (DataType::Int16, DataType::Int16) => contains!(arr, sub_arr, Int16Array), - (DataType::Int32, DataType::Int32) => contains!(arr, sub_arr, Int32Array), - (DataType::Int64, DataType::Int64) => contains!(arr, sub_arr, Int64Array), - (DataType::UInt8, DataType::UInt8) => contains!(arr, sub_arr, UInt8Array), - (DataType::UInt16, DataType::UInt16) => contains!(arr, sub_arr, UInt16Array), - (DataType::UInt32, DataType::UInt32) => contains!(arr, sub_arr, UInt32Array), - (DataType::UInt64, DataType::UInt64) => contains!(arr, sub_arr, UInt64Array), - (first_array_data_type, second_array_data_type) => { - Err(DataFusionError::NotImplemented(format!( - "Array_has_all is not implemented for types '{first_array_data_type:?}' and '{second_array_data_type:?}'." - ))) - } - } -} - -/// Array_has_any SQL function -pub fn array_has_any(args: &[ArrayRef]) -> Result { - assert_eq!(args.len(), 2); - let array = flatten_list_array::(args[0].clone())?; - // TODO: Dont need to flatten rhs array - let sub_array = flatten_list_array::(args[1].clone())?; - let mut boolean_array = Vec::with_capacity(array.len()); - - for (arr, sub_arr) in array.iter().zip(sub_array.iter()) { - if let (Some(arr), Some(sub_arr)) = (arr, sub_arr) { - let res = overlap_internal(arr.clone(), sub_arr.clone())?; - boolean_array.push(res); - } - } - Ok(Arc::new(BooleanArray::from(boolean_array))) -} - macro_rules! non_list_contains { ($ARRAY:expr, $SUB_ARRAY:expr, $ARRAY_TYPE:ident) => {{ let sub_array = downcast_arg!($SUB_ARRAY, $ARRAY_TYPE); @@ -1546,15 +1400,45 @@ pub fn array_has(args: &[ArrayRef]) -> Result { Ok(Arc::new(boolean_builder.finish())) } + // Int64, Int32, Int16, Int8 + // UInt64, UInt32, UInt16, UInt8 DataType::Int64 => { non_list_contains!(array, args[1], Int64Array) } + DataType::Int32 => { + non_list_contains!(array, args[1], Int32Array) + } + DataType::Int16 => { + non_list_contains!(array, args[1], Int16Array) + } + DataType::Int8 => { + non_list_contains!(array, args[1], Int8Array) + } + DataType::UInt64 => { + non_list_contains!(array, args[1], UInt64Array) + } + DataType::UInt32 => { + non_list_contains!(array, args[1], UInt32Array) + } + DataType::UInt16 => { + non_list_contains!(array, args[1], UInt16Array) + } + DataType::UInt8 => { + non_list_contains!(array, args[1], UInt8Array) + } + DataType::Float64 => { non_list_contains!(array, args[1], Float64Array) } + DataType::Float32 => { + non_list_contains!(array, args[1], Float32Array) + } DataType::Utf8 => { non_list_contains!(array, args[1], StringArray) } + DataType::LargeUtf8 => { + non_list_contains!(array, args[1], LargeStringArray) + } DataType::Boolean => { non_list_contains!(array, args[1], BooleanArray) } @@ -1567,6 +1451,100 @@ pub fn array_has(args: &[ArrayRef]) -> Result { } } +macro_rules! array_has_any_non_list_check { + ($ARRAY:expr, $SUB_ARRAY:expr, $ARRAY_TYPE:ident) => {{ + let arr = downcast_arg!($ARRAY, $ARRAY_TYPE); + let sub_arr = downcast_arg!($SUB_ARRAY, $ARRAY_TYPE); + + let mut res = false; + for elem in sub_arr.iter().dedup() { + res |= arr + .iter() + .dedup() + .flatten() + .any(|x| x == elem.expect("null type not supported")); + } + res + }}; +} + +/// Array_has_any SQL function +pub fn array_has_any(args: &[ArrayRef]) -> Result { + assert_eq!(args.len(), 2); + + let array = args[0].as_list::(); + let sub_array = args[1].as_list::(); + + let mut boolean_builder = BooleanArray::builder(array.len()); + for (arr, sub_arr) in array.iter().zip(sub_array.iter()) { + if let (Some(arr), Some(sub_arr)) = (arr, sub_arr) { + let res = match (arr.data_type(), sub_arr.data_type()) { + (DataType::List(_), DataType::List(_)) => { + let arr = downcast_arg!(arr, ListArray); + let sub_arr = downcast_arg!(sub_arr, ListArray); + + let mut res = false; + for elem in sub_arr.iter().dedup().flatten() { + res |= arr.iter().dedup().flatten().any(|x| *x == *elem); + } + res + } + // Int64, Int32, Int16, Int8 + // UInt64, UInt32, UInt16, UInt8 + (DataType::Int64, DataType::Int64) => { + array_has_any_non_list_check!(arr, sub_arr, Int64Array) + } + (DataType::Int32, DataType::Int32) => { + array_has_any_non_list_check!(arr, sub_arr, Int32Array) + } + (DataType::Int16, DataType::Int16) => { + array_has_any_non_list_check!(arr, sub_arr, Int16Array) + } + (DataType::Int8, DataType::Int8) => { + array_has_any_non_list_check!(arr, sub_arr, Int8Array) + } + (DataType::UInt64, DataType::UInt64) => { + array_has_any_non_list_check!(arr, sub_arr, UInt64Array) + } + (DataType::UInt32, DataType::UInt32) => { + array_has_any_non_list_check!(arr, sub_arr, UInt32Array) + } + (DataType::UInt16, DataType::UInt16) => { + array_has_any_non_list_check!(arr, sub_arr, UInt16Array) + } + (DataType::UInt8, DataType::UInt8) => { + array_has_any_non_list_check!(arr, sub_arr, UInt8Array) + } + + (DataType::Float64, DataType::Float64) => { + array_has_any_non_list_check!(arr, sub_arr, Float64Array) + } + (DataType::Float32, DataType::Float32) => { + array_has_any_non_list_check!(arr, sub_arr, Float32Array) + } + (DataType::Boolean, DataType::Boolean) => { + array_has_any_non_list_check!(arr, sub_arr, BooleanArray) + } + // Utf8, LargeUtf8 + (DataType::Utf8, DataType::Utf8) => { + array_has_any_non_list_check!(arr, sub_arr, StringArray) + } + (DataType::LargeUtf8, DataType::LargeUtf8) => { + array_has_any_non_list_check!(arr, sub_arr, LargeStringArray) + } + + _ => Err(DataFusionError::NotImplemented(format!( + "Array_has_any is not implemented for types '{:?}' and '{:?}'.", + arr.data_type(), + sub_arr.data_type() + )))?, + }; + boolean_builder.append_value(res); + } + } + Ok(Arc::new(boolean_builder.finish())) +} + macro_rules! array_has_all_non_list_check { ($ARRAY:expr, $SUB_ARRAY:expr, $ARRAY_TYPE:ident) => {{ let arr = downcast_arg!($ARRAY, $ARRAY_TYPE); @@ -1594,7 +1572,7 @@ pub fn array_has_all(args: &[ArrayRef]) -> Result { let mut boolean_builder = BooleanArray::builder(array.len()); for (arr, sub_arr) in array.iter().zip(sub_array.iter()) { if let (Some(arr), Some(sub_arr)) = (arr, sub_arr) { - match (arr.data_type(), sub_arr.data_type()) { + let res = match (arr.data_type(), sub_arr.data_type()) { (DataType::List(_), DataType::List(_)) => { let arr = downcast_arg!(arr, ListArray); let sub_arr = downcast_arg!(sub_arr, ListArray); @@ -1603,22 +1581,57 @@ pub fn array_has_all(args: &[ArrayRef]) -> Result { for elem in sub_arr.iter().dedup().flatten() { res &= arr.iter().dedup().flatten().any(|x| *x == *elem); } - boolean_builder.append_value(res); + res } + // Int64, Int32, Int16, Int8 + // UInt64, UInt32, UInt16, UInt8 (DataType::Int64, DataType::Int64) => { - let res = array_has_all_non_list_check!(arr, sub_arr, Int64Array); - boolean_builder.append_value(res); + array_has_all_non_list_check!(arr, sub_arr, Int64Array) + } + (DataType::Int32, DataType::Int32) => { + array_has_all_non_list_check!(arr, sub_arr, Int32Array) + } + (DataType::Int16, DataType::Int16) => { + array_has_all_non_list_check!(arr, sub_arr, Int16Array) + } + (DataType::Int8, DataType::Int8) => { + array_has_all_non_list_check!(arr, sub_arr, Int8Array) + } + (DataType::UInt64, DataType::UInt64) => { + array_has_all_non_list_check!(arr, sub_arr, UInt64Array) + } + (DataType::UInt32, DataType::UInt32) => { + array_has_all_non_list_check!(arr, sub_arr, UInt32Array) + } + (DataType::UInt16, DataType::UInt16) => { + array_has_all_non_list_check!(arr, sub_arr, UInt16Array) + } + (DataType::UInt8, DataType::UInt8) => { + array_has_all_non_list_check!(arr, sub_arr, UInt8Array) } + (DataType::Float64, DataType::Float64) => { - let res = array_has_all_non_list_check!(arr, sub_arr, Float64Array); - boolean_builder.append_value(res); + array_has_all_non_list_check!(arr, sub_arr, Float64Array) + } + (DataType::Float32, DataType::Float32) => { + array_has_all_non_list_check!(arr, sub_arr, Float32Array) + } + (DataType::Boolean, DataType::Boolean) => { + array_has_all_non_list_check!(arr, sub_arr, BooleanArray) + } + (DataType::Utf8, DataType::Utf8) => { + array_has_all_non_list_check!(arr, sub_arr, StringArray) + } + (DataType::LargeUtf8, DataType::LargeUtf8) => { + array_has_all_non_list_check!(arr, sub_arr, LargeStringArray) } _ => Err(DataFusionError::NotImplemented(format!( "Array_has_all is not implemented for types '{:?}' and '{:?}'.", arr.data_type(), sub_arr.data_type() )))?, - } + }; + boolean_builder.append_value(res); } } Ok(Arc::new(boolean_builder.finish()))