Skip to content

test(spanner): add tests for consuming PartialResultSet streams - #18604

Merged
olavloite merged 1 commit into
mainfrom
spanner-add-partial-result-set-tests
Oct 8, 2026
Merged

olavloite merged 1 commit into
mainfrom
spanner-add-partial-result-set-tests

Conversation

@olavloite

Copy link
Copy Markdown
Contributor

Adds a few missing test cases for consuming PartialResultSet streams to the Spanner Python client.

@olavloite
olavloite requested a review from a team as a code owner October 8, 2026 10:44

@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 adds comprehensive unit and acceptance tests for streaming chunked values (including empty strings, empty lists, bytes, resumption across retries, numeric, and JSON types) in both synchronous and asynchronous test suites. It also updates the _normalize_results helper to support NUMERIC and JSON types and handle None values. The feedback identifies two instances in the asynchronous tests where the built-in anext() function is used, which will raise a NameError on Python versions prior to 3.10. It is recommended to use the __anext__() dunder method instead to ensure backward compatibility.

Comment thread packages/google-cloud-spanner/tests/unit/_async/test_streamed.py
Comment thread packages/google-cloud-spanner/tests/unit/_async/test_streamed.py
Adds a few missing test cases for consuming PartialResultSet streams to the Spanner Python client.
@olavloite
olavloite force-pushed the spanner-add-partial-result-set-tests branch from a55353c to 000c171 Compare October 8, 2026 11:33
@olavloite

Copy link
Copy Markdown
Contributor Author

/gemini review

@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 adds comprehensive unit tests and acceptance tests for chunked value merging and streaming reads in the Google Cloud Spanner Python client, covering both synchronous and asynchronous implementations. Specifically, it introduces test cases for merging chunks of various data types—including FLOAT32, DATE, TIMESTAMP, INTERVAL, UUID, NUMERIC, and JSON—as well as their array counterparts. Additionally, the _normalize_results helper function in the test suites has been updated to correctly handle and normalize these new types and null values. I have no feedback to provide as there are no review comments.

olavloite added a commit that referenced this pull request Oct 8, 2026
Combines all non-draft, non-'do not merge' Spanner micro-optimization PRs:
- #18329: perf(spanner): optimize built-in metrics hot path and harden concurrency
- #18359: perf(spanner): optimize query parameter encoding with direct type dispatch
- #18379: perf(spanner): build ExecuteSqlRequest on the raw protobuf message
- #18408: perf(spanner): optimize request ID header generation and retry closures
- #18420: perf(spanner): prune lock and begin event allocations on single-use snapshots
- #18422: perf(spanner): avoid allocating empty RequestOptions on read and query paths
- #18602: perf(spanner): optimize single-chunk results and single-row lookups
- #18604: test(spanner): add tests for consuming PartialResultSet streams
@olavloite
olavloite merged commit a1ed9e0 into main Oct 8, 2026
54 checks passed
@olavloite
olavloite deleted the spanner-add-partial-result-set-tests branch October 8, 2026 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants