Change-stream mods.keys JSON drops sub-second precision for TIMESTAMP columns
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
Research direction
Start in backend/actions/change_stream.cc at CloudValueToJSONValue and inspect the TYPE_TIMESTAMP formatting path described in the issue. Reproduce the change-stream keys case and verify that the resulting JSON preserves fractional timestamp precision while existing behavior remains correct.
Written by the indexing model from the issue text.
Description
When a tracked table has a TIMESTAMP column in its primary key, the change-stream DataChangeRecord.mods[].keys JSON encodes that column without fractional seconds. Real Spanner preserves up to 9 fractional digits.
Repro:
- CREATE TABLE t (commit_ts TIMESTAMP NOT NULL, k INT64) PRIMARY KEY (commit_ts, k) + CREATE CHANGE STREAM s FOR t
- Insert a row with commit_ts = TIMESTAMP '1970-01-21T14:09:51.234567890Z'
- Read the change-stream; mods[0].keys.commit_ts is "1970-01-21T14:09:51Z" (decimals dropped)
Cause: backend/actions/change_stream.cc CloudValueToJSONValue uses absl::FormatTime("%Y-%m-%d%ET%H:%M:%SZ", ...) for TYPE_TIMESTAMP — %S emits integer seconds. Real Spanner emits fractional. The fix is %E*S (or %E9S).
Same function as #328 (UUID encoding), similar shape of fix.
Affected: any consumer that reconstructs row identity from keys JSON when a TIMESTAMP is part of the PK.
- Dominant language
- C++
- Stars
- 334
- Forks
- 77
- Avg merge
- 8m
- Merged PRs (30d)
- 2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from GoogleCloudPlatform/cloud-spanner-emulator
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
GoogleCloudPlatform/cloud-spanner-emulator#355 · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 68/100
GoogleCloudPlatform/cloud-spanner-emulator#366 · 1 comment · 5 reactions ·
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
All issues in GoogleCloudPlatform/cloud-spanner-emulator
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
AXERA-TECH/ax-llm#77 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
games-on-whales/wolf#509 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
bug-unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
NVIDIA/cuda-samples#453 ·