waynexia commented on code in PR #16859:
URL: https://github.com/apache/datafusion/pull/16859#discussion_r2229609157


##########
datafusion/functions/src/datetime/date_trunc.rs:
##########
@@ -185,6 +187,21 @@ impl ScalarUDFImpl for DateTruncFunc {
         ) -> Result<ColumnarValue> {
             let parsed_tz = parse_tz(tz_opt)?;
             let array = as_primitive_array::<T>(array)?;
+
+            // fast path for fine granularities
+            if matches!(
+                granularity.as_str(),
+                "second" | "minute" | "millisecond" | "microsecond"
+            ) || (parsed_tz.is_none() && granularity.as_str() == "hour")
+            {
+                let result = general_date_trunc_array_fine_granularity(

Review Comment:
   Thank you for your very detailed check and explanation. I find another 
example with an extra search (that website is great)...
   
   <img width="681" height="306" alt="image" 
src="https://github.com/user-attachments/assets/3816bbc1-6d50-492d-9a07-23663826d700";
 />
   



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

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to