Sean-Kenneth-Doherty opened a new pull request, #22296:
URL: https://github.com/apache/datafusion/pull/22296

   ## Which issue does this PR close?
   
   - Closes #22227.
   
   ## Rationale for this change
   
   `array_resize` can panic when a query asks for an impossibly large target 
size, for example `array_resize(make_array(1), 9223372036854775807, 0)`. The 
resize path was using the requested count to size fill arrays and mutable array 
buffers before rejecting values that cannot fit in the output list offsets or 
allocation limits.
   
   ## What changes are included in this PR?
   
   - Validates each non-null target size before using it for resize capacity 
planning.
   - Rejects target sizes that cannot fit the output list offset type.
   - Adds a conservative value-capacity check before materializing fill arrays 
or `MutableArrayData` buffers.
   - Adds a unit regression and an SQL logic regression for the large 
target-size query.
   
   Scope note: this is limited to `array_resize` target-size validation for 
#22227.
   
   ## Are these changes tested?
   
   Yes.
   
   - `cargo test -p datafusion-functions-nested 
array_resize_rejects_target_count_overflow`
   - `cargo test -p datafusion-sqllogictest --test sqllogictests -- 
array/array_resize.slt`
   - `cargo test -p datafusion-functions-nested`
   - `cargo fmt --check`
   - `cargo clippy -p datafusion-functions-nested --all-targets -- -D warnings`
   - `git diff --check`
   
   ## Are there any user-facing changes?
   
   Yes. Oversized `array_resize` target lengths now return a DataFusion 
execution error instead of panicking the process.
   


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