You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2023/06/28 18:52:43 UTC

[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #6789: Minor: Make `date_trunc` code easier to understand

alamb commented on code in PR #6789:
URL: https://github.com/apache/arrow-datafusion/pull/6789#discussion_r1245626134


##########
datafusion/physical-expr/src/datetime_expressions.rs:
##########
@@ -219,42 +219,49 @@ fn quarter_month(date: &NaiveDateTime) -> u32 {
 /// account that some granularities are not uniform durations of time
 /// (e.g. months are not always the same lengths, leap seconds, etc)
 fn date_trunc_coarse(granularity: &str, value: i64) -> Result<i64> {
-    if granularity == "millisecond" || granularity == "microsecond" {

Review Comment:
   this special case was what is confusing. I removed this one and inlined the `with_nanosecond(0)` call for all the other cases



-- 
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-unsubscribe@arrow.apache.org

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