From eef57b1a72e613531622195e74ff3743439767f3 Mon Sep 17 00:00:00 2001 From: obada-ab Date: Mon, 2 Oct 2023 14:09:24 +0200 Subject: [PATCH 1/2] Fix: getDouble in read API path --- .../java/com/google/cloud/bigquery/BigQueryResultImpl.java | 2 +- .../java/com/google/cloud/bigquery/it/ITBigQueryTest.java | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryResultImpl.java b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryResultImpl.java index 2a2aba7cd2..e944efceba 100644 --- a/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryResultImpl.java +++ b/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryResultImpl.java @@ -337,7 +337,7 @@ public double getDouble(String fieldName) throws SQLException { throw new SQLException(String.format("Field %s not found", fieldName)); } Object curVal = curRow.get(fieldName); - return curVal == null ? 0.0d : ((BigDecimal) curVal).doubleValue(); + return curVal == null ? 0.0d : new BigDecimal(curVal.toString()).doubleValue(); } } diff --git a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java index 549066c5fc..1ff8597455 100644 --- a/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java +++ b/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/it/ITBigQueryTest.java @@ -3230,7 +3230,7 @@ public void testReadAPIIterationAndOrderAsync() throws SQLException, ExecutionException, InterruptedException { // use read API to read 300K records and check the order String query = - "SELECT date, county, state_name, confirmed_cases, deaths FROM " + "SELECT date, county, state_name, confirmed_cases, deaths / 10 FROM " + TABLE_ID_LARGE.getTable() + " where date is not null and county is not null and state_name is not null order by confirmed_cases asc limit 300000"; @@ -3255,7 +3255,8 @@ public void testReadAPIIterationAndOrderAsync() assertNotNull(rs.getString(1)); assertNotNull(rs.getString(2)); assertTrue(rs.getInt(3) >= 0); - assertTrue(rs.getInt(4) >= 0); + assertTrue(rs.getDouble(3) >= 0); + assertTrue(rs.getDouble(4) >= 0); // check if the records are sorted assertTrue(rs.getInt(3) >= lasConfirmedCases); From 38f9de4f0d32210a1062dd6db69a464a43d7e9aa Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Mon, 2 Oct 2023 12:13:48 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 80b1ce1a99..80d18fd309 100644 --- a/README.md +++ b/README.md @@ -60,13 +60,13 @@ implementation 'com.google.cloud:google-cloud-bigquery' If you are using Gradle without BOM, add this to your dependencies: ```Groovy -implementation 'com.google.cloud:google-cloud-bigquery:2.33.0' +implementation 'com.google.cloud:google-cloud-bigquery:2.33.1' ``` If you are using SBT, add this to your dependencies: ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-bigquery" % "2.33.0" +libraryDependencies += "com.google.cloud" % "google-cloud-bigquery" % "2.33.1" ``` @@ -351,7 +351,7 @@ Java is a registered trademark of Oracle and/or its affiliates. [kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-bigquery/java11.html [stability-image]: https://img.shields.io/badge/stability-stable-green [maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-bigquery.svg -[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-bigquery/2.33.0 +[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-bigquery/2.33.1 [authentication]: https://github.com/googleapis/google-cloud-java#authentication [auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes [predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles