Weijun-H commented on code in PR #9108:
URL: https://github.com/apache/arrow-datafusion/pull/9108#discussion_r1501320634


##########
datafusion/physical-expr/src/array_expressions.rs:
##########
@@ -433,6 +435,7 @@ pub fn array_element(args: &[ArrayRef]) -> Result<ArrayRef> 
{
             let indexes = as_int64_array(&args[1])?;
             general_array_element::<i64>(array, indexes)
         }
+        DataType::Null => Ok(args[0].clone()),

Review Comment:
   > > in coercion step could filter if the function accepts the NULL type 
while in array_expressions it determines what the function should return
   > 
   > Does it mean we still need to do the null handling in `array_expression`? 
Take `array_append` for example, if we find null, we convert it to i64(None) 
and process it later on.
   > 
   > ideally, nulls should be handled in type coercion. And, `array_expression` 
can be _simple_ that just focuses on processing the result and not handling 
type or signature-related issues.
   > 
   
   It would be ideal if we could handle null in one place. However, array 
functions have different results for `NULL`. For instance, `array_append(null, 
1)` returns an error, whereas `array_has(null, 1)` returns null.
   



-- 
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...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to