jayzhan211 commented on code in PR #13372:
URL: https://github.com/apache/datafusion/pull/13372#discussion_r1845412166


##########
datafusion/sqllogictest/test_files/expr.slt:
##########
@@ -1096,23 +1096,27 @@ SELECT date_part('nanosecond', timestamp 
'2020-09-08T12:00:12.12345678+00:00')
 ----
 12123456780
 
-query R
+# Second argument should not be string, failed in postgres too.
+query error
 SELECT date_part('second', '2020-09-08T12:00:12.12345678+00:00')
+
+query R
+SELECT date_part('second', timestamp '2020-09-08T12:00:12.12345678+00:00')
 ----
 12.12345678
 
 query R
-SELECT date_part('millisecond', '2020-09-08T12:00:12.12345678+00:00')
+SELECT date_part('millisecond', timestamp '2020-09-08T12:00:12.12345678+00:00')

Review Comment:
   because the valid type should be timestamp but not string.
   
   This is the result in Postgres
   ```
   postgres=# SELECT date_part('millisecond', timestamp 
'2020-09-08T12:00:12.12345678+00:00');
    date_part 
   -----------
    12123.457
   (1 row)
   
   postgres=# SELECT date_part('millisecond', 
'2020-09-08T12:00:12.12345678+00:00');
   ERROR:  function date_part(unknown, unknown) is not unique
   LINE 1: SELECT date_part('millisecond', '2020-09-08T12:00:12.1234567...
                  ^
   HINT:  Could not choose a best candidate function. You might need to add 
explicit type casts.
   ```



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