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

   ## Which issue does this PR close?
   
   - Closes #22599.
   
   ## Rationale for this change
   
   Spark SQL supports `weekday(date)`, which returns the day of week as an 
integer with Monday as 0 and Sunday as 6. DataFusion's Spark-compatible 
function crate did not yet expose this compatibility function.
   
   ## What changes are included in this PR?
   
   This PR adds a Spark-compatible `weekday` scalar function under 
`datafusion-spark`.
   
   The function:
   - accepts date inputs and timestamp inputs coerced to date
   - returns `Int32`
   - returns Monday = 0 through Sunday = 6
   - preserves null behavior
   - is registered with the default Spark datetime functions and expression 
helpers
   
   It also adds SQLLogicTest coverage for scalar dates, all weekdays, 
timestamps, nulls, return type, and invalid argument cases.
   
   ## Are these changes tested?
   
   Yes.
   
   - `cargo fmt --all`
   - `cargo clippy --all-targets --all-features -- -D warnings`
   - `cargo test -p datafusion-spark`
   - `cargo test --test sqllogictests -- spark/datetime/weekday`
   - `git diff --check`
   
   ## Are there any user-facing changes?
   
   Yes. The `datafusion-spark` crate now supports the Spark-compatible 
`weekday` SQL function.
   


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