koopatroopa787 opened a new pull request, #22734:
URL: https://github.com/apache/datafusion/pull/22734

   ## Which issue does this PR close?
   
   Closes #22717
   
   ## Rationale for this change
   
   Spark's `next_day` function performs exact (case-insensitive) matching on 
the `dayOfWeek` argument. Whitespace-padded values like `' MO '` are not valid 
day names in Spark and should return `NULL`. DataFusion was calling `.trim()` 
before matching, so `' MO '` was silently accepted and returned a date — 
diverging from Spark's behavior.
   
   ## What changes are included in this PR?
   
   - `datafusion/spark/src/function/datetime/next_day.rs`: removed `.trim()` 
from the `spark_next_day` helper so whitespace-padded day names fall through to 
the `None` branch.
   - `datafusion/sqllogictest/test_files/spark/datetime/next_day.slt`: added 
three regression tests (`' MO '`, `' Monday '`, `'  sun  '`) that all now 
correctly return `NULL`.
   
   ## Are there any user-facing changes?
   
   Yes — `next_day(date, ' MO ')` now returns `NULL` instead of a date. This is 
a bug fix that aligns with Spark's actual behavior.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
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