feat(spanner): add experimental raw decode path for string columns#14631
Open
rahul2393 wants to merge 7 commits into
Open
feat(spanner): add experimental raw decode path for string columns#14631rahul2393 wants to merge 7 commits into
rahul2393 wants to merge 7 commits into
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces an experimental raw decode path for Spanner streaming SQL queries, allowing string columns to be retrieved as raw bytes via a new Row.ColumnBytes method to optimize performance. Key feedback includes a critical memory leak risk associated with using a global sync.Map to track row data, a failure to handle NULL values in the protobuf decoder, and compatibility issues where the raw path breaks standard Row methods like IsNull. It is also recommended to assign a unique name to the custom gRPC codec for better debuggability.
Contributor
Author
|
Running single thread larger read prober shows around 30% improvement in P50 latency
|
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.

Summary
Adds an opt-in experimental streaming decode path for allocation-sensitive Spanner queries.
The experimental path:
PartialResultSetresponsesThis path has a stricter row lifetime contract: returned rows are valid until the next
Next()call orStop(). Callers that need to retain values must copy them before advancing the iterator.Benchmark
Benchmarks use public client APIs with an in-process fake Spanner server, comparing default decode vs
QueryOptions{ExperimentalRawDecode: true}.Command:
Results on Apple M2 Max:
Benchmark shapes
BenchmarkCustomerShapePublicQuery:STRINGcolumnsBenchmarkReadLargeResultSetExactShapePublicQuery:BOOLBYTESDATEFLOAT32FLOAT64INTERVALJSONINT64NUMERICSTRINGTIMESTAMPUUIDNotes
This is intentionally experimental and should not be enabled by default.
Key limitations:
Next()again