Repository navigation
Trim-safe constructor errors and an Arrow.jl extension for Timestamp - #3
Merged
Merged
Conversation
- The `Timestamp{P}(y, m, d, …)` validation messages no longer interpolate a `Timestamp`
or a type: the resolution is named by `nameof(P)` and the range bounds by calendar
date through short `string` calls. Interpolating a `Timestamp` prints through dynamic
dispatch, and a `string` of more than about ten pieces is compiled with `Vararg{Any}`;
a `--trim=safe` build rejected both (found by MySQL.jl's trim check, which had to
bypass the constructor). The trim workload now exercises the error paths.
- `DurationsArrowExt` (weak dependency on Arrow.jl 2.8): a `Timestamp{P}` column is
written as Arrow's own timestamp type at unit `P` (no time zone), tagged with the
extension name `JuliaLang.Durations.Timestamp` so that it reads back as
`Timestamp{P}`; a reader without Durations sees a plain Arrow timestamp column.
Before, Arrow.jl wrote the value as a nested struct and read it back as a named tuple.
- Version 1.2.0.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
Two items found while making
Timestamp{P}the DATETIME/TIMESTAMP type of MySQL.jl 2.0.Trim-safe error messages. The
Timestamp{P}(y, m, d, …)validation messages interpolated the type parameter and, for the final range check,typemin/typemaxTimestampvalues. Printing aTimestampgoes through dynamic dispatch, and astring(...)of more than about ten pieces is compiled withVararg{Any}, so a--trim=safebuild that can reach the constructor fails verification (MySQL.jl's trim check had to build its values from a tick count to avoid it). The messages now name the resolution withnameof(P)and the bounds by calendar date, through shortstringcalls; the message text is otherwise unchanged. The trim workload now exercises the three error paths (with non-constant parts, so the calls are not folded into unconditional throws), and unit tests pin the message text.Arrow.jl extension. Arrow.jl 2.8.1 writes a
Timestamp{P}as a nested struct (instant.periods) and reads it back as a named tuple.DurationsArrowExt(weak dependency on Arrow 2.8) mapsTimestamp{P}to Arrow's own timestamp logical type at unitP(seconds, milliseconds, microseconds, or nanoseconds; no time zone), tagged with the extension nameJuliaLang.Durations.Timestampso that it reads back asTimestamp{P}; a reader without Durations loaded sees a plain Arrow timestamp column (DateTimein Arrow.jl).Union{Missing, Timestamp{P}}columns work through ArrowTypes' generic handling. Tests round-trip all four resolutions, check the raw column type withconvert=false, and check that Arrow.jl's ownDateTimemapping is untouched.Version bumped to 1.2.0 (new extension); drop that hunk if you prefer to bump at release time. On Julia 1.14, where
Durations.Timestamp === Dates.Timestamp, the extension's methods apply to the stdlib type; if Arrow.jl later adds its own mapping forDates.Timestamp, one of the two should yield.🤖 Generated with Claude Code