jayzhan211 commented on code in PR #14737:
URL: https://github.com/apache/datafusion/pull/14737#discussion_r1966326123
##########
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:
```
D select array_append(null, 1);
┌───────────────────────┐
│ array_append(NULL, 1) │
│ int32[] │
├───────────────────────┤
│ [1] │
└───────────────────────┘
D select array_concat(null, null);
┌──────────────────────────┐
│ array_concat(NULL, NULL) │
│ varchar │
├──────────────────────────┤
│ │
└──────────────────────────┘
D select array_append(null, null);
┌──────────────────────────┐
│ array_append(NULL, NULL) │
│ int32[] │
├──────────────────────────┤
│ [NULL] │
└──────────────────────────┘
```
Need to be careful not to break other array functions behaviour
--
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]