You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "Weijun-H (via GitHub)" <gi...@apache.org> on 2023/06/26 20:11:56 UTC

[GitHub] [arrow-datafusion] Weijun-H commented on a diff in pull request #6654: Make 'date_trunc' returns the same type as its input

Weijun-H commented on code in PR #6654:
URL: https://github.com/apache/arrow-datafusion/pull/6654#discussion_r1242712961


##########
datafusion/physical-expr/src/datetime_expressions.rs:
##########
@@ -827,7 +912,7 @@ mod tests {
             (
                 "2020-09-08T13:42:29.190855Z",
                 "second",
-                "2020-09-08T13:42:29.000000Z",
+                "2020-09-08T13:42:29.190855Z",

Review Comment:
   https://github.com/apache/arrow-datafusion/blob/b17cf0710938eed1c9f7794d5695bfac89bff580/datafusion/physical-expr/src/datetime_expressions.rs#L217-L223
   
   Previously, the truncation of timestamps to seconds occurred prematurely in `date_trunc_single`, resulting in inaccurate results. Therefore, I have made the necessary adjustments and deferred the logic to the `_date_trunc` function. By implementing this change, the granularity of the timestamps is preserved, and truncation is performed at a later stage to ensure accuracy.
   



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