public class QueryResponse extends Object implements Serializable
BigQuery.getQueryResults(JobId, BigQuery.QueryResultsOption...)
) or of a
Query Request (BigQuery.query(QueryRequest)
).
Example usage of a query response:
QueryResponse response = bigquery.query(request);
while (!response.jobCompleted()) {
Thread.sleep(1000);
response = bigquery.getQueryResults(response.getJobId());
}
List<BigQueryError> executionErrors = response.getExecutionErrors();
// look for errors in executionErrors
QueryResult result = response.getResult();
Iterator<List<FieldValue>> rowIterator = result.iterateAll();
while(rowIterator.hasNext()) {
List<FieldValue> row = rowIterator.next();
// do something with row
}
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
String |
getEtag()
Returns the hash of the
QueryResponse resource or null if not set. |
List<BigQueryError> |
getExecutionErrors()
Returns errors and warnings encountered during the running of the job, if any.
|
JobId |
getJobId()
Returns the identity of the BigQuery Job that was created to run the query.
|
QueryResult |
getResult()
Returns the result of the query.
|
boolean |
hasErrors()
Returns whether errors and warnings occurred during the execution of the job.
|
int |
hashCode() |
boolean |
jobCompleted()
Returns whether the job running the query has completed or not.
|
String |
toString() |
public QueryResult getResult()
public String getEtag()
QueryResponse
resource or null
if not set.public JobId getJobId()
public boolean jobCompleted()
getResult()
is not
null
, this method will always return true
. If this method returns false
getResult()
returns null
. This method can be used to check if query execution
completed and results are available.public boolean hasErrors()
true
it does not necessarily mean that the job has completed or was
unsuccessful.public List<BigQueryError> getExecutionErrors()
Copyright © 2017 Google. All rights reserved.