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(spanner): add support for Proto Columns in Connection API #3123

Merged
merged 37 commits into from
May 24, 2024

Conversation

harshachinta
Copy link
Contributor

@harshachinta harshachinta commented May 23, 2024

Adds support for Proto Columns feature in the Connection API.
This PR is taken from #2495.

gauravpurohit06 and others added 27 commits December 28, 2022 16:20
* feat: Importing Proto Changes

Commit will be reverted, once PROTO changes are available publicly.

* feat: Proto Message Implementation

* feat: Adding support for enum

* feat: Code refactoring

Adding default implementation for newly added methods
ByteArray compatability changes for Proto Messages

* docs: Adding Java docs for all the newly added methods.

* test: Sample Proto & Generated classes for unit test

* feat: Adding bytes/proto & int64/enum compatability

Adding Additional check for ChecksumResultSet

* test: Adding unit tests

* test: Adding unit tests for ValueBinder.java

* feat: refactoring to add support for getValue & other minor changes

* feat: Minor refactoring

1. Adding docs and formatting the code.
2. Adding additional methods for enum and message which accepts descriptors.

* feat: Adding bytes/message & int64/enum compatability in Value

* refactor: Minor refactoring

* feat: Adding Proto Array Implementation

* test: Implementing unit tests for array of protos and enums

* refactor: adding clirr ignores

* feat: Adding support for enum as Primary Key

* feat: Code Review Changes, minor refactoring and adding docs

* feat: Addressing review comments

-Modified Docs/Comments
-Minor Refactoring

* refactor: Using Column instead of column to avoid test failures

* feat: Minor refactoring

-code review comments
-adding function docs
googleapis#2211)

* samples: Adding samples for updating & querying Proto messages & enums

* style: linting

* style: linting

* docs: Adding function and class doc
* test: Adding Integration tests for Proto Messages & Enums

* test: Adding additional test for Parameterized Queries, Primary Keys & Invalid Wire type errors.

* style: Formatting

* style: Formatting

* test: Updating instance and db name

* test: Adding inter compatability check while writing data
* feat: add code changes and tests for Proto columns DDL support

* feat: add auto generated code

* feat: code changes and tests for Proto columns DDL support

* feat: add descriptors file

* feat: code refactoring

* feat: Integration tests and code refactoring

* feat: code refactoring

* feat: unit tests and clirr differences

* feat: lint changes

* feat: code refactor

* feat: code refactoring

* feat: code refactoring

* feat: code refactoring

* feat: add java docs to new methods

* feat: lint formatting

* feat: lint formatting changes

* feat: lint formatting

* feat: lint formatting

* feat: test exception cases

* feat: code refactoring

* feat: add java docs and refactoring

* feat: add java docs

* feat: java docs refactor

* feat: remove overload method setProtoDescriptors that accepts file path as input to avoid unexpected issues

* feat: remove updateDdl method overload to update proto descriptor
… fix autogenerated client side statement tests
@product-auto-label product-auto-label bot added the size: xl Pull request size is extra large. label May 23, 2024
Copy link

generated-files-bot bot commented May 23, 2024

Warning: This pull request is touching the following templated files:

  • proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/GetDatabaseDdlResponse.java
  • proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/SpannerDatabaseAdminProto.java
  • proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/UpdateDatabaseDdlRequest.java
  • proto-google-cloud-spanner-admin-database-v1/src/main/proto/google/spanner/admin/database/v1/spanner_database_admin.proto
  • proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/Type.java
  • proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TypeProto.java

@product-auto-label product-auto-label bot added the api: spanner Issues related to the googleapis/java-spanner API. label May 23, 2024
@harshachinta harshachinta added the owlbot:run Add this label to trigger the Owlbot post processor. label May 23, 2024
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label May 23, 2024
@harshachinta harshachinta marked this pull request as ready for review May 23, 2024 14:19
@harshachinta harshachinta requested review from a team as code owners May 23, 2024 14:19
@harshachinta harshachinta changed the title feat(spanner): add support for Proto Columns to Connection API feat(spanner): add support for Proto Columns in Connection API May 23, 2024
@harshachinta harshachinta added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label May 24, 2024
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label May 24, 2024
@harshachinta harshachinta requested a review from olavloite May 24, 2024 05:43
Comment on lines +1944 to +1946
// reset proto descriptors after executing a DDL statement
this.protoDescriptors = null;
this.protoDescriptorsFilePath = null;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make more sense to move this to setDefaultTransactionOptions()? It keeps the code cleaner, as we have all the reset code in one method, but it does mean that executing for example a query after setting the proto descriptors also clears the fields. One option to prevent the latter could be to add an input argument to setDefaultTransactionOptions() that indicates the type of statement that was executed, and only reset these fields if the last statement was a DDL statement.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, will check if it makes sense to move that logic to setDefaultTransactionOptions() as a seperate PR. This PR is very big that the code review will be difficult. Will work on this immediately.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment will be addressed in PR #3126

private final String instanceId;
private final String databaseName;

static class Builder {
private DatabaseAdminClient dbAdminClient;
private String projectId;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Instead of adding this field, could we change the individual fields projectId, instanceId, databaseName into one field of type DatabaseId?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, will do this along with the previous comment as a seperate PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment will be addressed in PR #3126

@harshachinta harshachinta added the owlbot:run Add this label to trigger the Owlbot post processor. label May 24, 2024
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label May 24, 2024
@harshachinta harshachinta merged commit 7e7c814 into googleapis:main May 24, 2024
32 checks passed
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.

4 participants