joroKr21 commented on code in PR #10790: URL: https://github.com/apache/datafusion/pull/10790#discussion_r1987015574
########## datafusion/functions-array/src/set_ops.rs: ########## @@ -259,6 +259,17 @@ fn generic_set_lists<OffsetSize: OffsetSizeTrait>( return general_array_distinct::<OffsetSize>(l, &field); } + // Handle empty array at rhs case + // array_union(arr, []) -> arr; + // array_intersect(arr, []) -> []; + if r.value_length(0).is_zero() { + if set_op == SetOp::Union { + return Ok(Arc::new(l.clone()) as ArrayRef); + } else { + return Ok(Arc::new(r.clone()) as ArrayRef); + } + } Review Comment: This will panic when `r` is empty and return wrong results when the first value in the `r` array is an empty list but the rest are not empty. -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org