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

BitmapFactory decodeByteArray SkImageDecoder Factory returned null - image from JSON
How can I stop the Thread in Java?
Why the primary id of a link / junction table row changes on existing rows when new row is added to it?
REST- Jersey - Exception obtaining parameters
remove comma and semicolon from webelement list
Scanner not assigning values to array
iText how to add bookmarks to existing PDF linking to locations of extracted text
Regex Between word
Identifying Search Crawler
where to instantiate simple values /entity objects? DDD
exception in thread awt-eventqueue-0 java.lang.nullpointerexception error for checkbox in jtable [duplicate]
Highlighting keywords in JTextArea (Netbeans)
Rectifying SOAP exception with java
jsTree, need to expand all the nodes when refreshing
User login fails when using password encoding in Spring
Which data structure to use for storage of matrix pairs?

Categories

HOME
ibm-bluemix
openlayers
atom-editor
proxy
isabelle
ngrx
tizen-web-app
youtube-api-v3
dxl
webpack-2
google-project-tango
yum
onelogin
node-notifier
pheatmap
primary-key
communication
resize
foselasticabundle
progressive-web-apps
normalizr
scichart
predix
swiftlint
scriptcs
tokenize
kudan
hammerspoon
android-widget
h2db
fish
selectedindexchanged
bootstrap-material-design
dbclient
libuv
sql-server-2012-express
media-queries
directx-10
textmate
language-concepts
bitbucket-pipelines
space-complexity
user-controls
squib
sfdc
elmah
google-closure
glew
heightmap
flashair
acoustics
segment
sas-jmp
apache-fop
prolog-setof
ionicons
sqlclient
magma
flow-control
medium.com
color-picker
instant
gridpane
httplistener
ado.net-entity-data-model
nsviewcontroller
superstack
ready-api
master-slave
make-install
rvest
ios8-today-widget
srand
quicklisp
wyam
emailrelay
ionic
createprocessasuser
vstest.console.exe
e10s
jsapi
lustre
gwidgets
typekit
qpainter
knuth
id3v2
doskey
transcoding
typo3-neos
mbr
inbox
spring-io
lcs
jelly
free-variable
gdata-api
newtonscript
nsmanagedobject
jquery-ui-layout
infobox
android-sdk-2.1
lang
bespin
fixed-width
brewmp
private-members
zune
commodore

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App