kumarUjjawal opened a new pull request, #22508:
URL: https://github.com/apache/datafusion/pull/22508

    ## Which issue does this PR close?
   
     - Closes #22507.
   
     ## Rationale for this change
   
     Some array functions were not handling null index or count arguments 
correctly.
   
     A null `size` or `max` value was sometimes treated like `0`, which gave 
wrong results like `[]` or the original array. `array_element` also depended on 
Arrow buffer values in null slots.
   
     This change makes these functions follow normal SQL null rules.
   
     ## What changes are included in this PR?
   
     - Make `array_resize` return `NULL` when `size` is `NULL`
     - Make `array_replace_n` return `NULL` when `max` is `NULL`
     - Make `array_remove_n` return `NULL` when `max` is `NULL`
     - Make `array_element` check for null indexes explicitly
     - Clean up `array_repeat` so null counts stay explicit in offset building
     - Update `array_remove_n` field nullability so planner metadata matches 
runtime behavior
     - Add regression tests for these cases
     - Update SQL logic test outputs for the changed null behavior
   
     ## Are these changes tested?
   
     Yes.
   
     I added regression tests for the changed Rust paths and updated the SQL 
logic tests.
   
   
     ## Are there any user-facing changes?
   
    These functions now return `NULL` for null index or count arguments instead 
of returning `[]`, an unchanged array, or relying on accidental behavior.


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

Reply via email to