alan910127 commented on code in PR #14737:
URL: https://github.com/apache/datafusion/pull/14737#discussion_r1966587874


##########
datafusion/sqllogictest/test_files/array.slt:
##########
@@ -2265,6 +2265,35 @@ select array_sort([]);
 ----
 []
 
+# test with null arguments
+# expected error:
+# DataFusion error: Error during planning: Failed to coerce arguments to 
satisfy a call to 'array_sort' function: coercion from [Null] to the signature 
OneOf([ArraySignature(Array { arguments: [Array], array_coercion: None }), 
ArraySignature(Array { arguments: [Array, DataType(Utf8)], array_coercion: None 
}), ArraySignature(Array { arguments: [Array, DataType(Utf8), DataType(Utf8)], 
array_coercion: None })]) failed No function matches the given name and 
argument types 'array_sort(Null)'. You might need to add explicit type casts.
+#      Candidate functions:
+#      array_sort(array)
+#      array_sort(array, Utf8)
+#      array_sort(array, Utf8, Utf8)
+query error
+select array_sort(NULL);

Review Comment:
   it seems like they're already broken in current main branch :thinking:
   
   ```
   ❯ gsw upstream/main -d
   HEAD is now at 6bfeb0272 fix: we are missing the unlimited case for bounded 
streaming when usi… (#14815)
   ❯ cargo run
   DataFusion CLI v45.0.0
   > select array_append(NULL, 1);
   Error during planning: Failed to coerce arguments to satisfy a call to 
'array_append' function: coercion from [Null, Int64] to the signature 
ArraySignature(Array { arguments: [Array, Element], array_coercion: 
Some(FixedSizedListToList) }) failed No function matches the given name and 
argument types 'array_append(Null, Int64)'. You might need to add explicit type 
casts.
           Candidate functions:
           array_append(array, element)
   > select array_append(NULL, NULL);
   Error during planning: Failed to coerce arguments to satisfy a call to 
'array_append' function: coercion from [Null, Null] to the signature 
ArraySignature(Array { arguments: [Array, Element], array_coercion: 
Some(FixedSizedListToList) }) failed No function matches the given name and 
argument types 'array_append(Null, Null)'. You might need to add explicit type 
casts.
           Candidate functions:
           array_append(array, element)
   > select array_concat(NULL, NULL);
   Error during planning: The array_concat function can only accept list as the 
args.
   ```



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

Reply via email to