-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Align NowFunc::new() with canonical ConfigOptions timezone and enhance documentation
#18347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
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
Delegate to new_with_config and enhance documentation. Add regression coverage for timestamp metadata consistency. Update the scalar functions guide to clarify the restored behavior of the deprecated helper in relation to the default timezone offset.
c820fea to
92c7f9c
Compare
alamb
approved these changes
Oct 29, 2025
Contributor
alamb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Contributor
|
we'll want to align the docs and test and the order of merges with #18359 where the default tz was updated to be |
tobixdev
pushed a commit
to tobixdev/datafusion
that referenced
this pull request
Nov 2, 2025
…hance documentation (apache#18347) ## Which issue does this PR close? * Closes apache#18219. --- ## Rationale for this change The deprecated `NowFunc::new()` constructor previously initialized its timezone using the shorthand offset `"+00"`, which was inconsistent with the canonical UTC offset format `"+00:00"` used by `ConfigOptions::default()`. This mismatch could cause subtle inconsistencies in `ScalarValue` comparisons or downstream timezone handling. This PR ensures backward compatibility while aligning `NowFunc::new()` with the canonical default configuration, making behavior consistent across both constructors. It also improves documentation to clarify this relationship and provides a regression test to confirm parity between the two initialization paths. --- ## What changes are included in this PR? * Updated the deprecated `NowFunc::new()` to delegate to `NowFunc::new_with_config(&ConfigOptions::default())`. * Added detailed doc comments explaining the rationale and proper usage of the constructors. * Introduced a new test module verifying that `NowFunc::new()` and `NowFunc::new_with_config()` produce identical return fields and scalar values. * Updated user documentation (`scalar_functions.md`) to note the constructor preference and clarify the canonical default timezone format (`+00:00`). --- ## Are these changes tested? ✅ Yes. A new test `now_func_default_matches_config` was added to confirm functional equivalence between the legacy and configuration-based constructors, including matching field outputs and scalar timezones. --- ## Are there any user-facing changes? * **Yes**, but backward-compatible: * `NowFunc::new()` remains available but now mirrors the canonical timezone offset (`+00:00`). * Documentation has been updated to guide users toward the preferred `NowFunc::new_with_config()` method. No breaking API or behavior changes are expected, as this update standardizes the default timezone while maintaining prior function signatures.
codetyri0n
pushed a commit
to codetyri0n/datafusion
that referenced
this pull request
Nov 11, 2025
…hance documentation (apache#18347) ## Which issue does this PR close? * Closes apache#18219. --- ## Rationale for this change The deprecated `NowFunc::new()` constructor previously initialized its timezone using the shorthand offset `"+00"`, which was inconsistent with the canonical UTC offset format `"+00:00"` used by `ConfigOptions::default()`. This mismatch could cause subtle inconsistencies in `ScalarValue` comparisons or downstream timezone handling. This PR ensures backward compatibility while aligning `NowFunc::new()` with the canonical default configuration, making behavior consistent across both constructors. It also improves documentation to clarify this relationship and provides a regression test to confirm parity between the two initialization paths. --- ## What changes are included in this PR? * Updated the deprecated `NowFunc::new()` to delegate to `NowFunc::new_with_config(&ConfigOptions::default())`. * Added detailed doc comments explaining the rationale and proper usage of the constructors. * Introduced a new test module verifying that `NowFunc::new()` and `NowFunc::new_with_config()` produce identical return fields and scalar values. * Updated user documentation (`scalar_functions.md`) to note the constructor preference and clarify the canonical default timezone format (`+00:00`). --- ## Are these changes tested? ✅ Yes. A new test `now_func_default_matches_config` was added to confirm functional equivalence between the legacy and configuration-based constructors, including matching field outputs and scalar timezones. --- ## Are there any user-facing changes? * **Yes**, but backward-compatible: * `NowFunc::new()` remains available but now mirrors the canonical timezone offset (`+00:00`). * Documentation has been updated to guide users toward the preferred `NowFunc::new_with_config()` method. No breaking API or behavior changes are expected, as this update standardizes the default timezone while maintaining prior function signatures.
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?
Rationale for this change
The deprecated
NowFunc::new()constructor previously initialized its timezone using the shorthand offset"+00", which was inconsistent with the canonical UTC offset format"+00:00"used byConfigOptions::default(). This mismatch could cause subtle inconsistencies inScalarValuecomparisons or downstream timezone handling.This PR ensures backward compatibility while aligning
NowFunc::new()with the canonical default configuration, making behavior consistent across both constructors. It also improves documentation to clarify this relationship and provides a regression test to confirm parity between the two initialization paths.What changes are included in this PR?
NowFunc::new()to delegate toNowFunc::new_with_config(&ConfigOptions::default()).NowFunc::new()andNowFunc::new_with_config()produce identical return fields and scalar values.scalar_functions.md) to note the constructor preference and clarify the canonical default timezone format (+00:00).Are these changes tested?
✅ Yes. A new test
now_func_default_matches_configwas added to confirm functional equivalence between the legacy and configuration-based constructors, including matching field outputs and scalar timezones.Are there any user-facing changes?
Yes, but backward-compatible:
NowFunc::new()remains available but now mirrors the canonical timezone offset (+00:00).NowFunc::new_with_config()method.No breaking API or behavior changes are expected, as this update standardizes the default timezone while maintaining prior function signatures.