kosiew opened a new pull request, #18347:
URL: https://github.com/apache/datafusion/pull/18347
## Which issue does this PR close?
* Closes #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.
--
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]