Standing-Man commented on code in PR #16828: URL: https://github.com/apache/datafusion/pull/16828#discussion_r2227062667
########## datafusion/sqllogictest/test_files/spark/datetime/last_day.slt: ########## @@ -21,7 +21,80 @@ # For more information, please see: # https://github.com/apache/datafusion/issues/15914 -## Original Query: SELECT last_day('2009-01-12'); -## PySpark 3.5.5 Result: {'last_day(2009-01-12)': datetime.date(2009, 1, 31), 'typeof(last_day(2009-01-12))': 'date', 'typeof(2009-01-12)': 'string'} -#query -#SELECT last_day('2009-01-12'::string); +query D +SELECT last_day('2009-01-12'::string); +---- +2009-01-31 + + +query D +SELECT last_day('2015-02-28'::string); +---- +2015-02-28 + +query D +SELECT last_day('2015-03-27'::string); +---- +2015-03-31 + +query D +SELECT last_day('2015-04-26'::string); +---- +2015-04-30 + +query D +SELECT last_day('2015-05-25'::string); +---- +2015-05-31 + +query D +SELECT last_day('2015-06-24'::string); +---- +2015-06-30 + +query D +SELECT last_day('2015-07-23'::string); +---- +2015-07-31 + +query D +SELECT last_day('2015-08-01'::string); +---- +2015-08-31 + +query D +SELECT last_day('2015-09-02'::string); +---- +2015-09-30 + +query D +SELECT last_day('2015-10-03'::string); +---- +2015-10-31 + +query D +SELECT last_day('2015-11-04'::string); +---- +2015-11-30 + +query D +SELECT last_day('2015-12-05'::string); +---- +2015-12-31 + + +query D +SELECT last_day('2016-01-06'::string); +---- +2016-01-31 + +query D +SELECT last_day('2016-02-07'::string); +---- +2016-02-29 + + +query ? +SELECT NULL; Review Comment: I've made the changes according to your suggestions. However, I'm still not entirely sure whether the type validation and coercion actually happen during the planning phase. Could you confirm if this is handled automatically, or if there's something else I should check? ``` query error SELECT last_day(); ---- DataFusion error: Error during planning: 'last_day' does not support zero arguments No function matches the given name and argument types 'last_day()'. You might need to add explicit type casts. Candidate functions: last_day(Date32) query error select last_day('foo'::string); ---- DataFusion error: Error during planning: Failed to coerce arguments to satisfy a call to 'last_day' function: coercion from [Utf8View] to the signature Exact([Date32]) failed No function matches the given name and argument types 'last_day(Utf8View)'. You might need to add explicit type casts. Candidate functions: last_day(Date32) ``` -- 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