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

fix: add support for arrays in ResultSets #36

Merged
merged 6 commits into from
Feb 22, 2022

Conversation

olavloite
Copy link
Collaborator

Adds support for arrays in query result sets. Arrays are not yet implemented on the backend, so this feature is for now only tested against a mock Spanner server.

<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-spanner</artifactId>
<version>6.17.4</version>
Copy link
Collaborator

@Vizerai Vizerai Feb 17, 2022

Choose a reason for hiding this comment

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

Don't we want the PG version of the library?
6.17.4-pg-SNAPSHOT

I don't believe the PG changes have been rolled into mainline yet.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the test-lib that contains the mock Spanner server. That is (AFAIK) not included in the PG snapshot release. So this will only be used for test and starting the mock Spanner server.

That being said, the PG feature has now been merged into the Java client library and released, so I'll update this PR to use that version instead.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hmm... I tried using the newest version of the Spanner testlib locally, but that does not work because of the API changes between 6.17.4 and 6.19.0. So we are better off using the 6.17.4 testlib here, and then update everything once the JDBC driver also has been updated to use 6.19.0 (or we have gotten rid of the JDBC driver altogether).

Copy link
Collaborator

Choose a reason for hiding this comment

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

We pull in the jdbc library 2.5.7-pg-SNAPSHOT which then pulls in the pg version of the client library 6.17.4-pg-SNAPSHOT.

Won't this lead to some problems by importing both versions of the library?
6.17.4-pg-SNAPSHOT
6.17.4

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That's a good point. They are actually importing two different things:

  1. The JDBC library indeed imports spanner-6.17.4-pg-SNAPSHOT. This is the main library (basically everything in src/main/java of the library).
  2. This import has the tag <type>testlib</type> which means that it only imports the test code of the library (basically everything in src/test/java of the library)

The above allows us to reuse test infrastructure from the client library. As it is imported with <scope>test</scope> it will also not be included in the build of PgAdapter, so it is not shipped to customers.

We actually do the same in the JDBC driver itself:

  1. This line imports the Spanner client library.
  2. This line imports the Spanner client library testlib using scope test.

@olavloite olavloite requested a review from Vizerai February 18, 2022 08:16
Copy link
Collaborator

@Vizerai Vizerai left a comment

Choose a reason for hiding this comment

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

LGTM

@olavloite olavloite merged commit 90bd661 into postgresql-dialect Feb 22, 2022
@olavloite olavloite deleted the arrays-resultset branch February 22, 2022 07:20
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