Jefffrey commented on code in PR #22610:
URL: https://github.com/apache/datafusion/pull/22610#discussion_r3385949759


##########
datafusion/functions/src/datetime/date_bin.rs:
##########
@@ -420,14 +418,46 @@ fn date_bin_months_interval(stride_months: i64, source: 
i64, origin: i64) -> Res
 }
 
 fn to_utc_date_time(nanos: i64) -> Result<DateTime<Utc>> {
-    let secs = nanos / NANOS_PER_SEC;
-    let nsec = (nanos % NANOS_PER_SEC) as u32;
+    // DateTime::from_timestamp requires a non-negative nanosecond part.
+    let secs = nanos.div_euclid(NANOS_PER_SEC);
+    let nsec = nanos.rem_euclid(NANOS_PER_SEC) as u32;

Review Comment:
   i think only `rem_euclid` does this? `div_euclid` just seems to decide which 
way to round up/down



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