You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 23, 2026. It is now read-only.
Can be reproduced by adding the following test to ITBigQueryTest (copied from testReadAPIIterationAndOrderAsync with minor changes):
@TestpublicvoidtestReadAPIGetDouble()
throwsSQLException, ExecutionException,
InterruptedException {
Stringquery =
"SELECT date, county, state_name, confirmed_cases, deaths 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";
ConnectionSettingsconnectionSettings =
ConnectionSettings.newBuilder()
.setDefaultDataset(DatasetId.of(DATASET))
.setPriority(
QueryJobConfiguration.Priority
.INTERACTIVE)
.build();
Connectionconnection = bigquery.createConnection(connectionSettings);
ListenableFuture<ExecuteSelectResponse> executeSelectFut = connection.executeSelectAsync(query);
ExecuteSelectResponseexSelRes = executeSelectFut.get();
BigQueryResultbigQueryResult = exSelRes.getResultSet();
ResultSetrs = bigQueryResult.getResultSet();
intcnt = 0;
intlasConfirmedCases = Integer.MIN_VALUE;
while (rs.next()) {
assertTrue(rs.getDouble(3) >= 0); // throws ClassCastException
++cnt;
}
assertEquals(300000, cnt);
connection.close();
}
Stack trace
java.lang.ClassCastException: class java.lang.Long cannot be cast to class java.math.BigDecimal (java.lang.Long and java.math.BigDecimal are in module java.base of loader 'bootstrap')
at com.google.cloud.bigquery.BigQueryResultImpl$BigQueryResultSet.getDouble(BigQueryResultImpl.java:340)
at com.google.cloud.bigquery.BigQueryResultImpl$BigQueryResultSet.getDouble(BigQueryResultImpl.java:355)
at com.google.cloud.bigquery.it.ITBigQueryTest.testReadAPIGetDouble(ITBigQueryTest.java:3296)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:299)
at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:293)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.lang.Thread.run(Thread.java:833)
Workaround
Adding setUseReadAPI(false) to force-avoid read API:
Line causing the issue:
java-bigquery/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryResultImpl.java
Line 340 in 8f85a4d
Steps to reproduce
Call
getDoublein a read API path result set.Can be reproduced by adding the following test to
ITBigQueryTest(copied fromtestReadAPIIterationAndOrderAsyncwith minor changes):Stack trace
Workaround
Adding
setUseReadAPI(false)to force-avoid read API:References
Internal b/300130086