Describe the bug
next_day(date, dayOfWeek) returns NULL for an unrecognised dayOfWeek even when spark.sql.ansi.enabled=true, where Spark throws SparkIllegalArgumentException (3.5+) / IllegalArgumentException (3.4) wrapped via QueryExecutionErrors.ansiIllegalArgumentError.
The native impl is datafusion-spark::SparkNextDay, which always returns NULL on parse failure regardless of the ANSI flag.
Steps to reproduce
SET spark.sql.ansi.enabled=true;
SELECT next_day(date('2024-01-01'), 'NOT_A_DAY');
-- Spark: throws SparkIllegalArgumentException
-- Comet: returns NULL
Expected behavior
Match Spark: throw under ANSI; return NULL otherwise.
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)returnsNULLfor an unrecogniseddayOfWeekeven whenspark.sql.ansi.enabled=true, where Spark throwsSparkIllegalArgumentException(3.5+) /IllegalArgumentException(3.4) wrapped viaQueryExecutionErrors.ansiIllegalArgumentError.The native impl is
datafusion-spark::SparkNextDay, which always returns NULL on parse failure regardless of the ANSI flag.Steps to reproduce
Expected behavior
Match Spark: throw under ANSI; return NULL otherwise.
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.