diff --git a/datafusion/physical-expr/src/array_expressions.rs b/datafusion/physical-expr/src/array_expressions.rs index 9de2561d4ea08..83e2b3953ccb8 100644 --- a/datafusion/physical-expr/src/array_expressions.rs +++ b/datafusion/physical-expr/src/array_expressions.rs @@ -1633,7 +1633,7 @@ fn general_set_op( match (array1.data_type(), array2.data_type()) { (DataType::Null, DataType::List(field)) => { if set_op == SetOp::Intersect { - return make_array(dbg!(&[])); + return Ok(new_empty_array(&DataType::Null)); } let array = as_list_array(&array2)?; general_array_distinct::(array, field) @@ -1660,7 +1660,7 @@ fn general_set_op( let array = as_large_list_array(&array1)?; general_array_distinct::(array, field) } - (DataType::Null, DataType::Null) => make_array(&[]), + (DataType::Null, DataType::Null) => return Ok(new_empty_array(&DataType::Null)), (DataType::List(_), DataType::List(_)) => { let array1 = as_list_array(&array1)?; diff --git a/datafusion/sqllogictest/test_files/array.slt b/datafusion/sqllogictest/test_files/array.slt index 45fec6fb4befe..3e76357ff2e84 100644 --- a/datafusion/sqllogictest/test_files/array.slt +++ b/datafusion/sqllogictest/test_files/array.slt @@ -2116,7 +2116,7 @@ select array_union(null, []); query ? select array_union(null, null); ---- -[] +NULL # array_union scalar function #11 query ? @@ -3051,7 +3051,7 @@ select array_intersect([1, 1, 2, 2, 3, 3], null); query ? select array_intersect(null, [1, 1, 2, 2, 3, 3]); ---- -[] +NULL query ? select array_intersect([], null); @@ -3061,12 +3061,12 @@ select array_intersect([], null); query ? select array_intersect(null, []); ---- -[] +NULL query ? select array_intersect(null, null); ---- -[] +NULL query ?????? SELECT list_intersect(make_array(1,2,3), make_array(2,3,4)),