Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support lazy decoding of query results #2847

Merged
merged 4 commits into from
Feb 9, 2024

Conversation

olavloite
Copy link
Collaborator

Adds an option for lazy decoding of query results. Currently, all values in a query result row are decoded from protobuf values to plain Java objects at the moment that the result set is advanced to the next row. This means that all values are decoded, regardless whether the application actually fetches these or not.

Lazy decoding also enables the possibility for (internal) consumers of a result set to access the protobuf value before it is converted to a plain Java object. This for example allows ChecksumResultSet to calculate the checksum based on the protobuf value, instead of a Java object, which can be more efficient.

Adds an option for lazy decoding of query results. Currently, all values
in a query result row are decoded from protobuf values to plain Java
objects at the moment that the result set is advanced to the next row.
This means that all values are decoded, regardless whether the
application actually fetches these or not.

Lazy decoding also enables the possibility for (internal) consumers
of a result set to access the protobuf value before it is converted
to a plain Java object. This for example allows ChecksumResultSet to
calculate the checksum based on the protobuf value, instead of a
Java object, which can be more efficient.
@olavloite olavloite requested a review from a team as a code owner January 27, 2024 12:40
@product-auto-label product-auto-label bot added size: l Pull request size is large. api: spanner Issues related to the googleapis/java-spanner API. labels Jan 27, 2024
@olavloite olavloite requested a review from ankiaga February 9, 2024 09:01
* perf: calculate checksum using protobuf values

* chore: cleanup

* test: remove unrelated test

* fix: undo change to public API

* chore: cleanup|
@product-auto-label product-auto-label bot added size: xl Pull request size is extra large. and removed size: l Pull request size is large. labels Feb 9, 2024
@olavloite olavloite merged commit 6fc57e4 into refactor-grpc-result-set Feb 9, 2024
20 checks passed
@olavloite olavloite deleted the lazy-decode-result-set branch February 9, 2024 15:01
olavloite added a commit that referenced this pull request Feb 9, 2024
* refactor: move inner classes to top level

Move the gRPC-related inner classes from AbstractResultSet to
top-level classes, so they are easier to modify and maintain.

This change only contains modifications that are needed to move
these inner classes. There are no functional changes.

* feat: support lazy decoding of query results (#2847)

* feat: support lazy decoding of query results

Adds an option for lazy decoding of query results. Currently, all values
in a query result row are decoded from protobuf values to plain Java
objects at the moment that the result set is advanced to the next row.
This means that all values are decoded, regardless whether the
application actually fetches these or not.

Lazy decoding also enables the possibility for (internal) consumers
of a result set to access the protobuf value before it is converted
to a plain Java object. This for example allows ChecksumResultSet to
calculate the checksum based on the protobuf value, instead of a
Java object, which can be more efficient.

* fix: add null check

* perf: calculate checksum using protobuf values (#2848)

* perf: calculate checksum using protobuf values

* chore: cleanup

* test: remove unrelated test

* fix: undo change to public API

* chore: cleanup|

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
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 googleapis/java-spanner API. size: xl Pull request size is extra large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants