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

   ## Which issue does this PR close?
   
   - Closes #22213
   
   ## Rationale for this change
   
   `to_timestamp` converted Decimal128 inputs to nanoseconds with unchecked 
`i128` multiplication followed by an `as i64` cast. Large Decimal128 values 
could overflow during nanosecond scaling, causing a panic in debug builds or a 
wrapped timestamp value in release builds.
   
   ## What changes are included in this PR?
   
   - Convert Decimal128-to-nanoseconds scaling to checked arithmetic.
   - Return a DataFusion error when the scaled value cannot fit in timestamp 
nanoseconds.
   - Cover both scalar and array Decimal128 overflow paths.
   - Add a sqllogictest regression for the reported query shape.
   
   ## Are these changes tested?
   
   - `cargo fmt --check`
   - `git diff --check`
   - 
`CARGO_TARGET_DIR=/home/sean/Projects/datafusion-runtime-set-nonascii/target 
CARGO_BUILD_JOBS=2 cargo test -p datafusion-functions --lib 
to_timestamp_decimal128`
   - 
`CARGO_TARGET_DIR=/home/sean/Projects/datafusion-runtime-set-nonascii/target 
CARGO_BUILD_JOBS=2 cargo clippy -p datafusion-functions --lib -- -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