Tianjie Deng
Tianjie Deng

Reputation: 111

Using "List" to retrieve queryResult of BigQuery only got 512 records

The queryResult showed that it has 13224 rows, then I used

List<TableRow> rows = queryResult.getRows();

Then it shows the list "rows" only has 512 rows.

Any help?

Upvotes: 0

Views: 809

Answers (2)

Jordan Tigani
Jordan Tigani

Reputation: 26617

You may not get all of the rows back if the rows are large or there are a lot of them. You can get the remaining rows by calling jobs.GetQUeryResults() or tabledata.List() with the corresponding offsets.

From https://developers.google.com/bigquery/docs/queries:

  1. Call jobs.query with your query string. This method takes an optional timeout period; if set to 0 or not specified, the method will default to 10 seconds. If the query returns within the specified timeout period, the method will return the first page of results. For additional results, call jobs.getQueryResults as described next. If the query timeout expires before the query has finished, the method will return jobComplete=false,, and you must call jobs.getQueryResults as described next. The query job will continue to run even after the timeout period until it finishes, either successfully or because an error has occurred.
  2. [If necessary] Call jobs.getQueryResults to page through additional results, to get results from a query that exceeded its timeout, or to examine any query results until the temporary table is deleted. This method lets you specify a start row, and also takes a timeout that behaves the same as the jobs.query timeout to allow waiting if the job is not yet complete.

Upvotes: 1

Gaurav Parvadiya
Gaurav Parvadiya

Reputation: 149

I think you have to use result set object to get the row. result_set.getString() method is used to fetch attribute of rows.

Upvotes: 0

Related Questions