You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/03/11 01:51:00 UTC

[GitHub] [arrow-datafusion] liukun4515 commented on a change in pull request #1974: Implement EXTRACT expression with week, month, day, hour

liukun4515 commented on a change in pull request #1974:
URL: https://github.com/apache/arrow-datafusion/pull/1974#discussion_r824323294



##########
File path: datafusion/tests/sql/expr.rs
##########
@@ -714,17 +714,36 @@ async fn in_list_array() -> Result<()> {
 
 #[tokio::test]
 async fn test_extract_date_part() -> Result<()> {
-    test_expression!("date_part('hour', CAST('2020-01-01' AS DATE))", "0");
-    test_expression!("EXTRACT(HOUR FROM CAST('2020-01-01' AS DATE))", "0");
-    test_expression!(
-        "EXTRACT(HOUR FROM to_timestamp('2020-09-08T12:00:00+00:00'))",
-        "12"
-    );
     test_expression!("date_part('YEAR', CAST('2000-01-01' AS DATE))", "2000");
     test_expression!(
         "EXTRACT(year FROM to_timestamp('2020-09-08T12:00:00+00:00'))",
         "2020"
     );
+    test_expression!("date_part('MONTH', CAST('2000-01-01' AS DATE))", "1");
+    test_expression!(
+        "EXTRACT(month FROM to_timestamp('2020-09-08T12:00:00+00:00'))",
+        "9"
+    );
+    test_expression!("date_part('WEEK', CAST('2003-01-01' AS DATE))", "1");
+
+    //TODO Creating logical plan for 'SELECT EXTRACT(WEEK FROM to_timestamp('2020-09-08T12:00:00+00:00'))'

Review comment:
       @Ted-Jiang Maybe you can file a pr to fix this.




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