2

Collecting data from BigQuery via R is failing with an Internal Error message.

For example, the following query (with specific table / project names hidden), attempts to download 2.9 million rows across 299 pages.

connection <- DBI::dbConnect(bigrquery::bigquery(), project = project, 
    billing = billing, page_size = page_size)

tbl <- dplyr::tbl(connection, paste0(dataset, ".", schema, ".", table))

data <- tbl %>% dplyr::collect()

This fails with the following error:

Complete Billed: 0 B Downloading 2,982,643 rows in 299 pages. Downloading data [=====>-------------------------------------------------------------------------------------------------------------------] 5% ETA: 5mError: An internal error occurred and the request could not be completed. [internalError]

When I look at BigQuery UI jobs, the query id itself is marked as successfully complete. Similarly when I look at the Stackdriver logging for the BigQuery API call, the job is also marked as successful.

Jobs of this nature have been failing when querying with a service token and individual user credentials. The error is intermittent, but seem most common when returning large numbers of rows. Running the same query directly in the BigQuery UI works succesfully, suggesting there is something problem with the final data collection / download step.

  • 1
    Hi, we are having a similar issue since yesterday. I suspect some change or issue on Google's side. We should probably open a support ticket. One workaround could be to ask BigQuery to export the results on GCS then download the data from there. – FurryMachine Oct 10 '19 at 14:33
  • The issue didn't happen in the past few days. Hopefully it's now fixed on Google's side. – FurryMachine Oct 15 '19 at 09:22
  • 1
    Looks like there was an issue in google end, they made a fix and now working fine. For those who suffered from the same issue try now again. And https://issuetracker.google.com/issues/142457683 is the url for public issue tracker. – Jaya Ananthram Oct 16 '19 at 06:14
  • @JayaAnanthram Nice find, consider posting it as an answer to make it more visible to the community and so that we may upvote it – JKleinne Oct 16 '19 at 16:29

0 Answers0