jkosh44 commented on issue #14451:
URL: https://github.com/apache/datafusion/issues/14451#issuecomment-2640335154

   > Hello [@jkosh44](https://github.com/jkosh44), what do you think about this?
   > 
   > `array_resize` should return `NULL` only if the second argument (new 
length) is `NULL`. If the third argument (new element) is `NULL`, the new slots 
(if any) should be set to `NULL`. This behavior would make `array_resize(array, 
new_len)` equivalent to `array_resize(array, new_len, NULL)`, which I think 
makes more sense.
   
   Good point, I don't think we can use `NullHandling` here and will just have 
to handle the NULL manually. The DuckDB behavior matches this as well.
   ```
   duckdb> select array_resize([1,2,3], 4, NULL);
   ┌─────────────────────────────────────────────────┐
   │ array_resize(main.list_value(1, 2, 3), 4, NULL) │
   ╞═════════════════════════════════════════════════╡
   │ [1, 2, 3, ]                                     │
   └─────────────────────────────────────────────────┘
   ```
   
   I think if we update the signature of `array_resize` to be more descriptive, 
then the error will go away.
   
   > Also, since `null_handling` makes `array_sort` return `NULL` for `NULL` 
inputs, should we still handle `NULL` cases in `array_sort_inner`?
   
   Yes, we should make sure that null handling is consistent for 
`ColumnarValue::Scalar(_)` and `ColumnarValue::Array(_)` inputs. As an FYI, I'm 
thinking that we should actually remove the `NullHandling` enum. I wrote up my 
rationale here: 
https://github.com/apache/datafusion/pull/14289#issuecomment-2640206878


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