Describe the bug
next_day(date, dayOfWeek) in Comet trims leading/trailing whitespace from the dayOfWeek argument before matching. Spark's DateTimeUtils.getDayOfWeekFromString does not trim, so values like ' MO ' succeed in Comet but Spark either returns NULL (non-ANSI) or throws (ANSI).
The trim happens in datafusion-spark::SparkNextDay.
Steps to reproduce
SELECT next_day(date('2024-01-01'), ' MO ');
-- Spark: NULL (or throws under ANSI)
-- Comet: 2024-01-08
Expected behavior
Do not trim; match Spark's character-for-character matching.
Additional context
Surfaced by the date/time audit (#4448). Reproducer captured as an ignored test in spark/src/test/resources/sql-tests/expressions/datetime/next_day.sql; remove the ignore(...) when this is fixed.
Describe the bug
next_day(date, dayOfWeek)in Comet trims leading/trailing whitespace from thedayOfWeekargument before matching. Spark'sDateTimeUtils.getDayOfWeekFromStringdoes not trim, so values like' MO 'succeed in Comet but Spark either returns NULL (non-ANSI) or throws (ANSI).The trim happens in
datafusion-spark::SparkNextDay.Steps to reproduce
Expected behavior
Do not trim; match Spark's character-for-character matching.
Additional context
Surfaced by the date/time audit (#4448). Reproducer captured as an ignored test in
spark/src/test/resources/sql-tests/expressions/datetime/next_day.sql; remove theignore(...)when this is fixed.