java


com.google.cloud.bigquery.BigQueryException: Read timed out


I am querying data from BigQuery
here is my code:
import com.google.cloud.bigquery.*;
public static JSONArray query(String tableId, String field, String val) throws Exception{
String queryString = "SELECT * FROM `" + tableId +"` where " + field + "=\"" + val + "\";";
BigQuery bigquery = BigQueryOptions.getDefaultInstance().getService();
// Create a query request
QueryRequest queryRequest =
QueryRequest.newBuilder(queryString)
.setMaxWaitTime(100000L)
.setPageSize(1000L)
.setUseLegacySql(false)
.build();
// Request query to be executed and wait for results
QueryResponse queryResponse = bigquery.query(queryRequest);
while (!queryResponse.jobCompleted()) {
Thread.sleep(1000L);
queryResponse = bigquery.getQueryResults(queryResponse.getJobId());
}
// Read rows
Iterator<List<FieldValue>> rowIterator = queryResponse.getResult().iterateAll();
while (rowIterator.hasNext()) {
System.out.println(rowIterator.next());
}
}
here is the data I'm trying to get which is in tableA and tableB:
{id: "111", data: {a: "222", b: "333"}}
when I run the query on first table
query("dataset.tableA", "data.a", "222")
I get the results well
but when I run the query on second table
query("dataset.tableB", "data.a", "222")
I get an error - even though when I query threw the webUI I get the results well:
here is the error:
Exception in thread "main" com.google.cloud.bigquery.BigQueryException: Read timed out
at com.google.cloud.bigquery.spi.DefaultBigQueryRpc.translate(DefaultBigQueryRpc.java:93)
at com.google.cloud.bigquery.spi.DefaultBigQueryRpc.query(DefaultBigQueryRpc.java:408)
at com.google.cloud.bigquery.BigQueryImpl$21.call(BigQueryImpl.java:584)
at com.google.cloud.bigquery.BigQueryImpl$21.call(BigQueryImpl.java:581)
at com.google.cloud.RetryHelper.doRetry(RetryHelper.java:179)
at com.google.cloud.RetryHelper.runWithRetries(RetryHelper.java:244)
at com.google.cloud.bigquery.BigQueryImpl.query(BigQueryImpl.java:580)
at com.example.helloworld.integration.helpers.BigQueryDownload.query(BigQueryDownload.java:59)
at com.example.helloworld.integration.helpers.BigQueryDownload.main(BigQueryDownload.java:36)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
at java.net.SocketInputStream.read(SocketInputStream.java:170)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at sun.security.ssl.InputRecord.readFully(InputRecord.java:465)
at sun.security.ssl.InputRecord.read(InputRecord.java:503)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:973)
at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:930)
at sun.security.ssl.AppInputStream.read(AppInputStream.java:105)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:286)
at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:704)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:647)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1569)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338)
at com.google.api.client.http.javanet.NetHttpResponse.<init>(NetHttpResponse.java:37)
at com.google.api.client.http.javanet.NetHttpRequest.execute(NetHttpRequest.java:94)
at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:981)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:419)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:352)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:469)
at com.google.cloud.bigquery.spi.DefaultBigQueryRpc.query(DefaultBigQueryRpc.java:406)

Related Links

Running Integration tests from a Docker image for Java project
Android (java platform) connection to the remote Python server
JavaFX: Child node bigger than Parent
javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake Support
How can I exit out of this loop?
Add comboBox at Kendo
Pass in more than just WebDriver to the constructor for PageFactory?
Android studio SQLite delete button not working - SQLiteException: near “?”: syntax error (code 1):
Inheritance and Static Nested Java Classes
Maven not found while using Gitlab-ci-multi-runner
Is there a way to use Jetty (or Tomcat)'s servlet's engine only (remove all JSP functionality)?
Java Scanner(System.in) does not open file after user input
Does Spring Data MongoDB supports MongoDB 3.4 collation feature?
maven dependency - 3 projects and 1 framework project dependency not be including
if i select distance in one combobox than distance units will be displayed in another combobox ,similarly with currency [duplicate]
Why ArrayIndexOutOfBound Exception can be caught in Java, but C++ program crashes instead? [duplicate]

Categories

HOME
maven
image
gremlin
iot
platform-builder
syntax
electron
relay
cvs
electronics
jgroups
enterprise-library-5
fancybox
wheelnav.js
quickbooks
etl
correlation
commonmark
windows-phone-7
iolanguage
clearcase-ucm
lombok
systemc
openrefine
transformation
samoa
paging
jasonette
css-animations
sylius
excel-2007
kudan
mmap
tdd
spark-jobserver
semantic-analysis
bootstrap-duallistbox
kannel
publish
ping
quote
google-cloud-nl
oracle-fusion-middleware
noraui
nssegmentedcontrol
appfabric
adobe-premiere
objectlistview
streamreader
total-commander
websphere-mq-fte
skeleton-css-boilerplate
dds
multipeer-connectivity
mplayer
google-perftools
python-cryptography
django-scheduler
minimization
mediaelement
nested-sets
visual-c++-2008
static-ip-address
angular-cache
merge-conflict-resolution
autorest
flash-cs5
independentsoft
uid
xna-4.0
qtableview
comobject
wireshark-dissector
fluid-dynamics
graph-api-explorer
typekit
jsonpickle
file-copying
wordpress-theme-customize
doskey
xceed-datagrid
jplaton
back-stack
gridcontrol
eventlistener
kyotocabinet
unc
multipage
twrequest
qtkit
ohm
asyncfileupload
doh
mod-auth
subgurim-maps
horizontal-accordion
calling-convention
actionview
subviews
coda-slider
gamma
routedevent
uimenucontroller
text-coloring
putchar
data-acquisition

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App