sam-1112 opened a new pull request, #7746:
URL: https://github.com/apache/datafusion-comet/pull/7746

   ## Which issue does this PR close?
   
   Part of #7500. Add output-size checks before allocation for `base64`, 
`randstr`, `lpad`, `rpad`, read-side padding, and binary-to-string casts. 
Oversized output returns an error suggesting a smaller batch size instead of 
causing offset-overflow panics or excessive allocations.
   
   ## Rationale for this change
   
   Expanding string kernels can produce batches beyond Arrow's offset limit. 
Unchecked output sizes can cause offset-overflow panics or excessive 
allocations instead of returning an error.
   
   ## What changes are included in this PR?
   
   - Check output sizes before allocating buffers for `base64`, `randstr`, 
`lpad`, `rpad`, and read-side padding.
   - Guard binary-to-string casts across all supported output styles.
   - Use checked arithmetic and exact output counts where conservative 
estimates could reject valid output.
   - Account for multibyte padding, Base64 line wrapping, null values, and 
sliced inputs.
   - Preserve JVM-compatible UTF-8 replacement semantics and the valid UTF-8 
fast path.
   - Reject oversized `randstr` output before initializing or advancing its RNG.
   - Return errors suggesting a smaller `spark.comet.batchSize`.
   
   ## How are these changes tested?
   
   - 81 common crate unit tests and 1,395 expression crate unit tests passed.
   - Regression tests cover oversized allocation requests, exact capacity 
boundaries, arithmetic overflow, multibyte padding, Base64 wrapping, nulls, 
slices, dictionary input, and split UTF-8 code points.
   - `randstr` tests verify that rejected requests preserve the RNG sequence.
   
   ```
   cargo test -p datafusion-comet-common -p datafusion-comet-spark-expr --lib
   
   cargo clippy -p datafusion-comet-common -p datafusion-comet-spark-expr 
--all-targets -- -D warnings
   ```
   


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