Skip to content

chore(spanner): add DATE and TIMESTAMP codecs for key recipe routing - #6288

Open
olavloite wants to merge 1 commit into
googleapis:mainfrom
olavloite:spanner-key-recipe-temporal-types
Open

chore(spanner): add DATE and TIMESTAMP codecs for key recipe routing#6288
olavloite wants to merge 1 commit into
googleapis:mainfrom
olavloite:spanner-key-recipe-temporal-types

Conversation

@olavloite

Copy link
Copy Markdown
Contributor

Add a standalone temporal codecs module (routing::temporal) to support Spanner DATE and TIMESTAMP key column evaluation in location-aware routing. This implementation parses ISO 8601 date strings into days since Unix epoch and RFC 3339 timestamp strings into UTC offset seconds and nanoseconds, converting them into Spanner's ordered binary format (ssformat). The module includes full support for valid Spanner date ranges (0001-01-01 to 9999-12-31), non-UTC timezone offsets, leap second normalization, and verification of chronological sort order preservation.

Add a standalone temporal codecs module (`routing::temporal`) to support Spanner `DATE` and `TIMESTAMP` key column evaluation in location-aware routing. This implementation parses ISO 8601 date strings into days since Unix epoch and RFC 3339 timestamp strings into UTC offset seconds and nanoseconds, converting them into Spanner's ordered binary format (`ssformat`). The module includes full support for valid Spanner date ranges (`0001-01-01` to `9999-12-31`), non-UTC timezone offsets, leap second normalization, and verification of chronological sort order preservation.
@olavloite
olavloite requested review from a team as code owners August 5, 2026 16:58
@product-auto-label product-auto-label Bot added the api: spanner Issues related to the Spanner API. label Aug 5, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new temporal module in the Spanner routing crate, implementing codecs for DATE and TIMESTAMP data types to support location-aware routing. It includes robust parsing and encoding functions to convert ISO 8601 dates and RFC 3339 timestamps into Spanner's binary representation, along with comprehensive unit tests covering edge cases like leap years, timezone offsets, and chronological sorting. No review comments were provided, and the implementation looks solid and well-tested, so I have no additional feedback.

@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.31034% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.25%. Comparing base (0df927e) to head (e5fb5e4).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/spanner/src/routing/temporal.rs 99.31% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6288      +/-   ##
==========================================
+ Coverage   96.23%   96.25%   +0.01%     
==========================================
  Files         280      281       +1     
  Lines       72146    72436     +290     
==========================================
+ Hits        69433    69724     +291     
+ Misses       2713     2712       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Labels

api: spanner Issues related to the Spanner API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant