viirya commented on code in PR #6654:
URL: https://github.com/apache/arrow-datafusion/pull/6654#discussion_r1245435778


##########
datafusion/physical-expr/src/datetime_expressions.rs:
##########
@@ -215,13 +215,17 @@ fn quarter_month(date: &NaiveDateTime) -> u32 {
 }
 
 fn date_trunc_single(granularity: &str, value: i64) -> Result<i64> {
+    if granularity == "millisecond" || granularity == "microsecond" {
+        return Ok(value);
+    }

Review Comment:
   You mean `with_nanosecond` also cleans up millisecond and microsecond in the 
timestamp? Otherwise nanosecond is smaller granularity than millisecond and 
microsecond. Why reduction at nanosecond level will affect millisecond and 
microsecond? 
   
   E.g, timestamp is 1.001000001 (1s + 1 ms + 1 ns). After 
`with_nanosecond(0)`, it will be 1.000000000 instead of 1.001000000?



-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to