findepi commented on code in PR #13209:
URL: https://github.com/apache/datafusion/pull/13209#discussion_r1825175937
##########
datafusion/functions-nested/src/resize.rs:
##########
@@ -134,6 +136,23 @@ pub(crate) fn array_resize_inner(arg: &[ArrayRef]) ->
Result<ArrayRef> {
return exec_err!("array_resize needs two or three arguments");
}
+ let array = &arg[0];
+
+ // Checks if entire array is null
+ if array.null_count() == array.len() {
Review Comment:
`array` is an array of arrays, right?
what happens if some values are null and some other are not?
For example a query processes some null and non-null arrays
```
> SELECT a FROM (VALUES (make_array(1)), (arrow_cast(NULL, 'List(Int32)')),
(make_array(3))) t(a);
+-----+
| a |
+-----+
| [1] |
| |
| [3] |
+-----+
```
currently, array_resize converts second array (being null) into an empty
array.
```
> SELECT array_resize(a, 1) FROM (VALUES (make_array(1)), (arrow_cast(NULL,
'List(Int32)')), (make_array(3))) t(a);
+----------------------------+
| array_resize(t.a,Int64(1)) |
+----------------------------+
| [1] |
| [] |
| [3] |
+----------------------------+
```
--
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]