alamb commented on code in PR #24365:
URL: https://github.com/apache/datafusion/pull/24365#discussion_r3784918542


##########
datafusion/functions-nested/src/replace.rs:
##########
@@ -367,6 +397,24 @@ impl ScalarUDFImpl for ArrayReplaceAll {
     }
 }
 
+/// Return field shared by `array_replace`, `array_replace_n` and
+/// `array_replace_all`: the input list type, except that its inner field is
+/// nullable whenever the replacement element may be null.
+fn replace_return_field(name: &str, arg_fields: &[FieldRef]) -> 
Result<FieldRef> {
+    // `array` is at index 0 and `to` at index 2 for all three functions.
+    // `from` never contributes values to the output, so `to` is the only
+    // argument besides `array` that can affect the output's type.
+    let [array_field, _from_field, to_field, ..] = arg_fields else {

Review Comment:
   Is the idea that if `from` is null, then it wouldn't match anything anyways 
(and leave the array_field) unchanged?  So thus the `_from_field`  nullability 
is ignored?



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to