tustvold commented on code in PR #5517:
URL: https://github.com/apache/arrow-datafusion/pull/5517#discussion_r1131237011


##########
datafusion/optimizer/src/unwrap_cast_in_comparison.rs:
##########
@@ -428,6 +452,36 @@ fn try_cast_literal_to_type(
     }
 }
 
+/// Cast a timestamp value from one unit to another
+fn cast_between_timestamp(from: DataType, to: DataType, value: i128) -> 
Option<i64> {

Review Comment:
   I think this has problematic overflow behaviour, I wonder if we can 
determine the scale factor and multiply or divide by this instead? This is what 
arrow-cast does - 
https://github.com/apache/arrow-rs/blob/master/arrow-cast/src/cast.rs#L1671
   
   Currently I think converting `i64::MAX / 1_000` to milliseconds from seconds 
will silently overflow, when in reality it shouldn't



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

Reply via email to