jayzhan211 commented on code in PR #8269:
URL: https://github.com/apache/arrow-datafusion/pull/8269#discussion_r1398531988
##########
datafusion/physical-expr/src/array_expressions.rs:
##########
@@ -580,6 +580,21 @@ pub fn array_except(args: &[ArrayRef]) -> Result<ArrayRef>
{
let array2 = &args[1];
match (array1.data_type(), array2.data_type()) {
+ (DataType::Null, DataType::Null) => {
+ // NullArray(1): means null, NullArray(0): means []
+ // except([], []) = [], except([], null) = [], except(null, []) =
null, except(null, null) = null
+ let nulls = match (array1.len(), array2.len()) {
+ (1, _) => Some(NullBuffer::new_null(1)),
+ _ => None,
+ };
+ let arr = Arc::new(ListArray::try_new(
+ Arc::new(Field::new("item", DataType::Null, true)),
+ OffsetBuffer::new(vec![0; 2].into()),
+ Arc::new(NullArray::new(0)),
+ nulls,
+ )?) as ArrayRef;
+ Ok(arr)
Review Comment:
I think we can return `make_array(&[])` instead?
##########
datafusion/expr/src/built_in_function.rs:
##########
@@ -599,12 +599,33 @@ impl BuiltinScalarFunction {
BuiltinScalarFunction::ArrayReplaceAll =>
Ok(input_expr_types[0].clone()),
BuiltinScalarFunction::ArraySlice =>
Ok(input_expr_types[0].clone()),
BuiltinScalarFunction::ArrayToString => Ok(Utf8),
- BuiltinScalarFunction::ArrayIntersect =>
Ok(input_expr_types[0].clone()),
- BuiltinScalarFunction::ArrayUnion =>
Ok(input_expr_types[0].clone()),
+ BuiltinScalarFunction::ArrayIntersect => {
Review Comment:
Can you merge these three in one with '|' since they are no longer one line
code now.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]