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

   ## Which issue does this PR close?
   
   - Closes #22218 
   
   ## Rationale for this change
   
   The scalar path of array_repeat can overflow while computing the total 
number of repeated values. Previously, the implementation used unchecked 
accumulation for these totals, which could lead to overflow behavior that was 
not explicitly handled. This change makes the capacity and offset calculations 
overflow-safe and returns a clear execution error when the total output size 
exceeds usize.
   
   ## What changes are included in this PR?
   
   - Adds overflow checks for the total repeated value count in the scalar 
array_repeat path.
   - Adds overflow checks for outer and inner total size calculations in the 
list repeat path.
   - Preserves the existing behavior where non-positive counts are treated as 
zero.
   - Adds sqllogictest coverage for the overflow error case.
   
   ## Are these changes tested?
   
   - Yes. A new sqllogictest covers the scalar overflow failure case for 
array_repeat.
   - Existing related tests continue to pass.
   
   ## Are there any user-facing changes?
   
   - Yes. For extremely large inputs, array_repeat now returns a clear 
execution error instead of relying on implicit overflow behavior.
   - Normal inputs are unchanged.


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