Repository navigation
fix: correct millis-to-micros conversion for Avro timestamp-millis in Document conversion - #122
Merged
orfeon merged 1 commit intoAug 16, 2026
Conversation
… Document conversion DateTimeUtil.toProtoTimestamp(Long) expects epoch microseconds, but the timestamp-millis branch of AvroToDocumentConverter divided the epoch millis value by 1000, passing epoch seconds instead. The resulting Firestore/Datastore timestamp was off by a factor of 10^6, collapsing every timestamp-millis field to a value just after the epoch. The adjacent timestamp-micros branch already passes its value through unchanged, confirming microseconds is the expected unit. Adds regression tests covering the timestamp-millis path, the timestamp-micros path, and agreement between the two encodings of the same instant.
orfeon
approved these changes
Aug 16, 2026
orfeon
left a comment
Member
There was a problem hiding this comment.
Thank you for your contribution!
kratos0718
added a commit
to kratos0718/portfolio
that referenced
this pull request
Sep 20, 2026
Merged-PR stat was showing 17 while the actual count is 22 - the OpenSource.tsx list was missing mercari/pipeline#122, apache/maven- help-plugin#424, grokability/snipe-it#19514, phasespace-labs/ palinode#132, and the newly-merged apache/maven-shared-jar#165. Added all five with real quotes/stars pulled from each PR, and updated the Landing and OpenSource stat badges and bio/tagline text in portfolioData.ts to match.
kratos0718
added a commit
to kratos0718/portfolio
that referenced
this pull request
Nov 12, 2026
Merged-PR stat was showing 17 while the actual count is 22 - the OpenSource.tsx list was missing mercari/pipeline#122, apache/maven- help-plugin#424, grokability/snipe-it#19514, phasespace-labs/ palinode#132, and the newly-merged apache/maven-shared-jar#165. Added all five with real quotes/stars pulled from each PR, and updated the Landing and OpenSource stat badges and bio/tagline text in portfolioData.ts to match.
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.
Follow-up to #119, in the Avro → Firestore/Datastore Document path.
Problem
DateTimeUtil.toProtoTimestamp(Long)interprets its argument as epoch microseconds:AvroToDocumentConverterpasses it epoch seconds on thetimestamp-millisbranch:The value ends up wrong by a factor of 10^6.
2026-08-07T10:15:30.123Z(epoch millis1786097730123) becomes1786seconds —1970-01-01T00:29:46Z. Everytimestamp-millisfield written through this path collapses to just after the epoch, silently.The adjacent
timestamp-microsbranch passinglstraight through confirms microseconds is the expected unit. Of the call sites oftoProtoTimestampoutsideDateTimeUtil, this is the only one that divides.The path is reachable from
MElementandElementToDocumentConverter, andtimestamp-millisis a first-class logical type here (REQUIRED_LOGICAL_TIMESTAMP_MILLI_TYPE/NULLABLE_LOGICAL_TIMESTAMP_MILLI_TYPE).Fix
l/1000L→l * 1000L, converting millis to the micros the callee expects.Tests
Adds
AvroToDocumentConverterTestwith three cases:testTimestampMillisFieldexpected:<1786097730> but was:<1786>testTimestampMillisAndMicrosAgreeexpected seconds 1786097730, was 1786testTimestampMicrosFieldtestTimestampMicrosFieldpasses both before and after by design — it guards the already-correct branch against over-correction.Note
Building from a clean clone needed
org.apache.kafka:kafka-clientsadded locally — Beam ships it atprovidedscope so it is not pulled transitively bybeam-sdks-java-io-kafka(same thing reported in the second half of #108). That is unrelated to this change and is not included here; I only added it locally to run the tests. Happy to open a separate PR if useful.