Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
date_binwith an explicit origin drifts an hour across a DST transition #25168.Rationale for this change
An explicit
origin_timestampchosen to aligndate_binbins 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_bindocumentation: 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 atdate_truncfor calendar units, and atdate_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.rsand mirrored intodocs/source/user-guide/sql/scalar_functions.md(whichdev/update_function_docs.shregenerates 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 --checkon the touched crate.Are there any user-facing changes?
Documentation only. No behaviour change, no public API change.