MaxGekk commented on PR #56354:
URL: https://github.com/apache/spark/pull/56354#issuecomment-4643442400

   @stevomitric good catch. Both nanos types are `DatetimeType`, so 
`canANSIStoreAssign` returned true for the pair and, now that the cast 
resolves, ANSI store assignment would have silently truncated `INSERT INTO 
micros_tbl SELECT nanos_col`.
   
   I've blocked the narrowing direction (`nanos(p) -> micros`) in 
`Cast.canANSIStoreAssign` so it stays explicit-only. STRICT already rejected it 
(`canUpCast` is unchanged), and comparison/UNION widening is unaffected (gated 
by `findWiderDateTimeType`). The lossless widening `micros -> nanos(p)` remains 
allowed under ANSI store assignment. Added a contract test covering all four 
pairs in both directions.
   
   Done in 1fcb25d.


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