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

   ## Which issue does this PR close?
   
   - Closes #25168.
   
   ## Rationale for this change
   
   An explicit `origin_timestamp` chosen to align `date_bin` bins to local 
midnight works until the timezone's offset changes, then silently shifts the 
bins by an hour. There is no error and no warning. This is not a bug in 
DataFusion — PostgreSQL and DuckDB return identical results, because all three 
bin on the instant measured from a fixed origin — but the pattern looks correct 
in every test that does not cross a DST transition, so the issue asks for it to 
be documented.
   
   ## What changes are included in this PR?
   
   Adds a short note to the `date_bin` documentation: an explicit origin fixes 
an instant, not a recurring local time, so bins aligned to local midnight with 
an origin silently shift by an hour across a daylight saving time transition. 
It points users at `date_trunc` for calendar units, and at `date_bin(<stride>, 
to_local_time(t AT TIME ZONE '<zone>'))` for strides that are not calendar 
units.
   
   The note is added to the rustdoc in 
`datafusion/functions/src/datetime/date_bin.rs` and mirrored into 
`docs/source/user-guide/sql/scalar_functions.md` (which 
`dev/update_function_docs.sh` regenerates from the rustdoc).
   
   ## What is the testing strategy for this PR?
   
   Docs-only change; no code or test behaviour is touched.
   
   - `cargo test -p datafusion-functions --lib` — 410 passed, 0 failed.
   - `cargo fmt --check` on the touched crate.
   
   ## Are there any user-facing changes?
   
   Documentation only. No behaviour change, no public API change.
   


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