andygrove commented on PR #23892:
URL: https://github.com/apache/datafusion/pull/23892#issuecomment-5529449337

   Rebased onto `main`. The conflict was substantive rather than textual, so 
noting the resolution here.
   
   #24194 landed a fix for the same panic while this branch was open, and it 
closes #23891 — the issue this branch also addressed. The two fixes are not 
equivalent:
   
   - This branch used `checked_add_signed`, which avoids the panic but returns 
NULL once the next occurrence passes `chrono::NaiveDate::MAX`.
   - #24194 computes the result on the epoch day (`days.checked_add(delta)`), 
which returns the value Spark's `Int` arithmetic produces.
   
   main's behavior is the correct one, so `next_date_for_day_of_week` now uses 
the epoch-day arithmetic and the weaker fix is dropped. Consequences:
   
   - The unit test `next_day_returns_null_past_the_last_representable_date` 
asserted NULL past `NaiveDate::MAX`. It is renamed to 
`..._returns_values_past_...` and now asserts the epoch day. A start day that 
is not itself a representable date still returns NULL, since the weekday is 
derived via `NaiveDate`.
   - Three `next_day.slt` cases asserted NULL for the same reason. Those epoch 
days have no `Date32` rendering, so they are cast to `Int32` and assert the 
epoch day, matching how #24194 wrote its own slt cases.
   - #24194's `next_day_handles_far_future_start_dates` called 
`spark_next_day`, which this branch splits into `parse_day_of_week` and 
`next_date_for_day_of_week`. It is ported to the new function and kept, along 
with its #23891 reference.
   
   What is left specific to this branch is the ANSI-mode handling and the 
missing `(date literal, string column)` argument shape.
   
   Verified on the rebased branch: `datafusion-spark` 281 unit tests pass, and 
all 244 `spark/` slt files pass. `cargo fmt` and `cargo clippy -p 
datafusion-spark --all-targets -D warnings` are clean.
   


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