jayzhan211 commented on code in PR #8054:
URL: https://github.com/apache/arrow-datafusion/pull/8054#discussion_r1383237442
##########
datafusion/physical-expr/src/array_expressions.rs:
##########
@@ -2763,6 +2789,52 @@ mod tests {
);
}
+ #[test]
+ fn test_array_replace_with_null() {
+ // ([3, 1, NULL, 3], 3, 4, 2) => [4, 1, NULL, 4] NULL not
matched
+ // ([3, 1, NULL, 3], NULL, 5, 2) => [3, 1, NULL, 3] NULL not
replaced (not eq)
Review Comment:
> I think it is because in SQL, `NULL = NULL` is _NOT_ `true` like you might
expect, but is actually `NULL`
>
> If we want the `NULL = NULL` = true behavior, we could use the
`not_distinct` kernel instead:
https://docs.rs/arrow/latest/arrow/compute/kernels/cmp/fn.not_distinct.html
I would prefer having `not_distinct` here, it can let us replace null value
with another, if we use `eq` here, replace with null value is meaningless, also
there is no other DB have the similar function
https://github.com/apache/arrow-datafusion/issues/7072, so I think we can have
our own definition of what `array_replace` do.
--
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]