Skip to content

perf(spanner): optimize decoding of large result sets#8454

Open
olavloite wants to merge 5 commits into
mainfrom
spanner-optimize-decoding
Open

perf(spanner): optimize decoding of large result sets#8454
olavloite wants to merge 5 commits into
mainfrom
spanner-optimize-decoding

Conversation

@olavloite
Copy link
Copy Markdown
Contributor

Optimizes row decoding for large result sets for the Spanner client by determining the type of decoder that should be used once, and then reuse that for each row. Also optimizes some of the specific decoders to use a fast-path option for the most common cases (e.g. valid DATE and TIMESTAMP strings).

@olavloite olavloite requested a review from a team as a code owner June 8, 2026 08:34
@product-auto-label product-auto-label Bot added the api: spanner Issues related to the Spanner API. label Jun 8, 2026
Copy link
Copy Markdown
Contributor

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

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 performance optimizations for decoding Spanner values, including fast-path parsing for YYYY-MM-DD date strings and RFC 3339 timestamps, compiling specialized cell decoding closures, and caching decoders in PartialResultStream. Feedback highlights two critical issues: first, the fast-path date parser in SpannerDate uses the local timezone instead of UTC, which can lead to off-by-one errors; second, the fallback logic for struct fields in createDecoder incorrectly handles falsy values, potentially resulting in data loss.

Comment thread handwritten/spanner/src/codec.ts
Comment thread handwritten/spanner/src/codec.ts Outdated
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