andygrove opened a new issue, #4450:
URL: https://github.com/apache/datafusion-comet/issues/4450

   ## 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
   
   ```sql
   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.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to