Skip to content

Commit ce5180a

Browse files
authored
deps: bump Spanner client to 6.57.0 (#1474)
Updates the Spanner client to 6.57.0 and modifies some test cases to work with the newest version of the Spanner client. The manual changes other than the dependency update are: 1. The Spanner client now supports PROTO and PROTO ENUM columns. This is also reflected in the RandomResultSetGenerator, which means that the number of columns is increased from 18 to 22. 2. The above addition of PROTO and PROTO ENUM means that the error message changes when you try to get a blob with a wrong column. 3. The newly introduced statement cache must be disabled, as there is a small bug that prevents the first query to include any default query options (e.g. optimizer version).
1 parent e14af90 commit ce5180a

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
<dependency>
6363
<groupId>com.google.cloud</groupId>
6464
<artifactId>google-cloud-spanner-bom</artifactId>
65-
<version>6.56.0</version>
65+
<version>6.57.0</version>
6666
<type>pom</type>
6767
<scope>import</scope>
6868
</dependency>

src/main/java/com/google/cloud/spanner/jdbc/JdbcDriver.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,8 @@ public Connection connect(String url, Properties info) throws SQLException {
191191
if (matcher.matches()) {
192192
// strip 'jdbc:' from the URL, add any extra properties and pass on to the generic
193193
// Connection API
194+
// TODO: Remove when statement cache should be enabled by default.
195+
System.setProperty("spanner.statement_cache_size_mb", "0");
194196
String connectionUri = appendPropertiesToUrl(url.substring(5), info);
195197
ConnectionOptions options = ConnectionOptions.newBuilder().setUri(connectionUri).build();
196198
JdbcConnection connection = new JdbcConnection(url, options);

src/test/java/com/google/cloud/spanner/jdbc/PartitionedQueryMockServerTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public void testPartitionedQueryUsingSql() throws SQLException {
158158
partitionStatement.setBoolean(1, true);
159159
try (ResultSet results = partitionStatement.executeQuery()) {
160160
assertNotNull(results.getMetaData());
161-
assertEquals(18, results.getMetaData().getColumnCount());
161+
assertEquals(22, results.getMetaData().getColumnCount());
162162
int rowCount = 0;
163163
while (results.next()) {
164164
rowCount++;
@@ -376,7 +376,7 @@ public void testAutoPartitionMode() throws SQLException {
376376
try (ResultSet results =
377377
connection.createStatement().executeQuery("select * from my_table where active=true")) {
378378
assertNotNull(results.getMetaData());
379-
assertEquals(18, results.getMetaData().getColumnCount());
379+
assertEquals(22, results.getMetaData().getColumnCount());
380380
int rowCount = 0;
381381
while (results.next()) {
382382
rowCount++;
@@ -482,7 +482,7 @@ public void testAutoPartitionModeEmptyResult() throws SQLException {
482482
try (ResultSet results =
483483
connection.createStatement().executeQuery("select * from my_table where active=true")) {
484484
assertNotNull(results.getMetaData());
485-
assertEquals(18, results.getMetaData().getColumnCount());
485+
assertEquals(22, results.getMetaData().getColumnCount());
486486
int rowCount = 0;
487487
while (results.next()) {
488488
rowCount++;

src/test/java/com/google/cloud/spanner/jdbc/PgNumericResultSetTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,8 @@ public void testGetBytes() throws Exception {
491491
resultSetMatcherFrom(resultSet, ResultSet::getBytes, ResultSet::getBytes);
492492

493493
matcher.nextAndAssertError(
494-
IllegalStateException.class, "expected BYTES but was NUMERIC<PG_NUMERIC>");
494+
IllegalStateException.class,
495+
"expected one of [[PROTO, BYTES]] but was NUMERIC<PG_NUMERIC>");
495496
matcher.nextAndAssertEquals(null);
496497
}
497498
}
@@ -600,7 +601,8 @@ public void testGetBlob() throws Exception {
600601
resultSetMatcherFrom(resultSet, ResultSet::getBlob, ResultSet::getBlob);
601602

602603
matcher.nextAndAssertError(
603-
IllegalStateException.class, "expected BYTES but was NUMERIC<PG_NUMERIC>");
604+
IllegalStateException.class,
605+
"expected one of [[PROTO, BYTES]] but was NUMERIC<PG_NUMERIC>");
604606
matcher.nextAndAssertEquals(null);
605607
}
606608
}

0 commit comments

Comments
 (0)