Skip to content

feat(transcode): round-4 Date(Month) and Date(Year) precision support#318

Merged
AdaWorldAPI merged 1 commit into
mainfrom
claude/transcode-round4-date-precision-L3DF0
Apr 30, 2026
Merged

feat(transcode): round-4 Date(Month) and Date(Year) precision support#318
AdaWorldAPI merged 1 commit into
mainfrom
claude/transcode-round4-date-precision-L3DF0

Conversation

@AdaWorldAPI
Copy link
Copy Markdown
Owner

Summary

Closes the deferred item from PR #316: parse_iso_date_to_days previously only accepted YYYY-MM-DD, even when the column was declared Date(Month) or Date(Year). Round-4 widens the parser to accept all three precisions, treating lower-precision inputs as the earliest point in the period:

Input Interpreted as Days since epoch
YYYY-MM-DD exact day (Hinnant)
YYYY-MM first day of the month 1970-02 → 31
YYYY first day of the year 2000 → 10_957

Algorithm itself unchanged (Howard Hinnant civil_to_days). The match parts.as_slice() lets the parser default the missing components without changing the math.

Tests (5 new + 1 expanded; 13 typed_resolver total)

  • typed_resolver_iso_year_only_parses_to_jan_1
  • typed_resolver_iso_year_month_parses_to_day_1
  • typed_resolver_iso_lower_precision_rejects_bad_components — bad month / bad day / non-numeric / empty year
  • typed_resolver_iso_lower_precision_handles_leap_year_feb2020-02 = day 31 of 2020 = 18_293 since epoch
  • typed_resolver_iso_date_rejects_garbage (expanded) — adds empty-string + 4-part-input rejection cases

13/13 typed_resolver tests pass under query-lite,auth-rls-lite. Clippy clean, fmt clean.

What's still deferred (round-5 territory)

  • Strict-mode parser that REFUSES cross-precision inputs (e.g. a column declared Date(Day) rejects a YYYY-only string). Today's permissive default is the right round-1 choice for graceful up-cast; strict-mode lands when a consumer asks.
  • Date(DateTime) precision — ISO timestamp parser would need a Timestamp column type, not Date32. Different Arrow plumbing.

Cross-link

Test plan

  • cargo test transcode::zerocopy::tests::typed_resolver — 13/13 pass
  • cargo clippy --all-targets --features query-lite,auth-rls-lite -- -D warnings
  • cargo fmt --check

Generated by Claude Code

Closes the deferred item from PR #316: parse_iso_date_to_days
previously only accepted YYYY-MM-DD, even for columns declared
Date(Month) or Date(Year). Round-4 widens the parser to accept
all three precisions, treating lower-precision inputs as the
earliest point in the period:

  YYYY-MM-DD  exact day
  YYYY-MM     first day of the month  (1970-02 -> 31)
  YYYY        first day of the year   (2000    -> 10_957)

Algorithm unchanged (Howard Hinnant civil_to_days). The match on
parts.as_slice() lets the parser decide what to default for the
missing components without changing the math.

## Tests (5 new + 1 expanded; 13 typed_resolver total)

  typed_resolver_iso_year_only_parses_to_jan_1
  typed_resolver_iso_year_month_parses_to_day_1
  typed_resolver_iso_lower_precision_rejects_bad_components
    -- bad month / bad day / non-numeric / empty year
  typed_resolver_iso_lower_precision_handles_leap_year_feb
    -- 2020-02 = day 31 of 2020 = 18_293 since epoch
  typed_resolver_iso_date_rejects_garbage (expanded)
    -- adds empty-string + 4-part-input rejection cases

## What's still deferred (round-5 territory)

- Strict-mode parser that REFUSES cross-precision inputs (e.g.
  a column declared Date(Day) rejects a YYYY-only string). Today's
  permissive default is the right round-1 choice for graceful
  up-cast; strict-mode lands when a consumer asks.
- Date(DateTime) precision -- ISO timestamp parser would need a
  Timestamp column type, not Date32. Different Arrow plumbing.

Verified: cargo test transcode::zerocopy::tests::typed_resolver::
13/13 pass under query-lite,auth-rls-lite. Clippy clean,
fmt clean.

Cross-link: PR #316 (round-3 typed-value resolver), PR #313
(round-1 triples_to_batch, where Date(_) was first plumbed).
@AdaWorldAPI AdaWorldAPI merged commit 9687541 into main Apr 30, 2026
1 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant