kumarUjjawal commented on code in PR #19640:
URL: https://github.com/apache/datafusion/pull/19640#discussion_r2665253198


##########
datafusion/sqllogictest/test_files/information_schema.slt:
##########
@@ -793,14 +793,11 @@ string_agg String AGGREGATE
 query TTTTTTTBTTTT rowsort
 select * from information_schema.routines where routine_name = 'date_trunc' OR 
routine_name = 'string_agg' OR routine_name = 'rank' ORDER BY routine_name
 ----
-datafusion public date_trunc datafusion public date_trunc FUNCTION true 
Timestamp(Microsecond, None) SCALAR Truncates a timestamp value to a specified 
precision. date_trunc(precision, expression)
-datafusion public date_trunc datafusion public date_trunc FUNCTION true 
Timestamp(Microsecond, Some("+TZ")) SCALAR Truncates a timestamp value to a 
specified precision. date_trunc(precision, expression)
-datafusion public date_trunc datafusion public date_trunc FUNCTION true 
Timestamp(Millisecond, None) SCALAR Truncates a timestamp value to a specified 
precision. date_trunc(precision, expression)
-datafusion public date_trunc datafusion public date_trunc FUNCTION true 
Timestamp(Millisecond, Some("+TZ")) SCALAR Truncates a timestamp value to a 
specified precision. date_trunc(precision, expression)
-datafusion public date_trunc datafusion public date_trunc FUNCTION true 
Timestamp(Nanosecond, None) SCALAR Truncates a timestamp value to a specified 
precision. date_trunc(precision, expression)
-datafusion public date_trunc datafusion public date_trunc FUNCTION true 
Timestamp(Nanosecond, Some("+TZ")) SCALAR Truncates a timestamp value to a 
specified precision. date_trunc(precision, expression)
-datafusion public date_trunc datafusion public date_trunc FUNCTION true 
Timestamp(Second, None) SCALAR Truncates a timestamp value to a specified 
precision. date_trunc(precision, expression)
-datafusion public date_trunc datafusion public date_trunc FUNCTION true 
Timestamp(Second, Some("+TZ")) SCALAR Truncates a timestamp value to a 
specified precision. date_trunc(precision, expression)
+datafusion public date_trunc datafusion public date_trunc FUNCTION true Date 
SCALAR Truncates a timestamp or time value to a specified precision. 
date_trunc(precision, expression)
+datafusion public date_trunc datafusion public date_trunc FUNCTION true String 
SCALAR Truncates a timestamp or time value to a specified precision. 
date_trunc(precision, expression)

Review Comment:
   ```
   SELECT arrow_typeof(date_trunc('day', to_date('2024-01-15')));
   -- Returns: Timestamp(ns)
   
   SELECT arrow_typeof(date_trunc('day', '2024-01-15'));  
   -- Returns: Timestamp(ns)
   ```
   
   Yes, the actual runtime return type is `Timestamp(Nanosecond)`, not `Date` 
or `String`.
   
   The coercion from `Date` / `String` to `Timestamp` happens at **planning 
time**, before `invoke_with_args` is called.
   
   The `Date` / `String` entries in `information_schema` represent the 
**signature variants** generated by the coercible API’s implicit coercion 
sources. However, the `return_type` method receives the **already-coerced 
type** (`Timestamp`) and returns that.
   
   So the functional behavior is correct, this is how coercible signatures are 
represented in metadata.
   



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