vboo123 commented on PR #57372:
URL: https://github.com/apache/spark/pull/57372#issuecomment-5028654939

   The null/CAST_OVERFLOW behavior for out-of-range decimal→timestamp is 
consistent with how existing overflow casts already handle this (e.g., 
`SecondsToTimestamp`, timestamp→byte/short/int). The approach here looks 
correct.
   
   One thing I noticed: this changes user-visible behavior (4.2 returns a 
silently-wrong wrapping value from unguarded `.longValue` truncation, 4.3 
returns null or raises CAST_OVERFLOW), but there's no entry in 
`docs/sql-migration-guide.md`. There's direct precedent for documenting this — 
under "Upgrading from Spark SQL 3.5 to 4.0":
   
   > Since Spark 4.0, when overflowing during casting timestamp to 
byte/short/int under non-ansi mode, Spark will return null instead a wrapping 
value.
   
   Should we add a bullet to the existing "Upgrading from Spark SQL 4.2 to 4.3" 
section. Something like:
   
   > Since Spark 4.3, when casting a decimal to timestamp overflows Long after 
scaling, Spark returns null (non-ANSI mode) or raises CAST_OVERFLOW (ANSI mode) 
instead of a wrapping value.
   
   WDYT?


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