sarahyurick commented on code in PR #3763:
URL: https://github.com/apache/arrow-datafusion/pull/3763#discussion_r992663284


##########
datafusion/sql/src/planner.rs:
##########
@@ -5309,6 +5456,19 @@ mod tests {
         assert!(logical_plan("SELECT \"1\"").is_err());
     }
 
+    #[test]
+    fn test_datetime_keyword_conversion() {
+        // Field "year" does not exist in table.
+        let sql_expr = "SELECT AVG(year) FROM person";
+        let err1 = logical_plan(sql_expr).expect_err("query should have 
failed");
+        assert_plan_error(err1, "Avg");

Review Comment:
   The general idea of this test is that originally, the query would have 
failed with a "Field Not Found" error because "year" isn't in the "person" 
table. However, because Avg is a function and "year" isn't in the table, we 
want to convert "year" to a datetime keyword to check if it is valid, so with 
my changes it fails with a "The function Avg does not support inputs of type 
Utf8" instead.
   
   This is a pretty roundabout way of testing the functionality, but because 
these changes were implemented to allow datetime keyword conversion before 
calling something like Timestampadd in Dask-SQL, which DataFusion does not 
support, this was the alternative testing method I came up with.



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

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

Reply via email to