Skip to content

Conversation

@kosiew
Copy link
Contributor

@kosiew kosiew commented Oct 29, 2025

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

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.
@github-actions github-actions bot added documentation Improvements or additions to documentation functions Changes to functions implementation and removed documentation Improvements or additions to documentation labels Oct 29, 2025
@kosiew kosiew force-pushed the timezone-inconsistency-18219 branch from c820fea to 92c7f9c Compare October 29, 2025 09:49
@kosiew kosiew marked this pull request as ready for review October 29, 2025 11:29
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @kosiew -- this makes sense to me

@Omega359 can you take a look too if you have a moment?

@Omega359
Copy link
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 None (vs +00:00 previously). Otherwise I think this is a great PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

functions Changes to functions implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NowFunc::new() seeds the timezone with "+00" while the canonical UTC offset remains "+00:00" in ConfigOptions::default().

3 participants