-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(bigquery): Remove ReadAPI bypass in executeSelect() #3624
Conversation
Move readAPI condition check from getExecuteSelectResponse() to queryRpc(). This allows fast query to be used with ReadAPI.
Still working on ideas for a testing strategy to make sure the requests are going to the endpoints that we want, but I wanted to get your opinions on the fix. |
A Boolean field is added to keep track of whether or not the high throughput ReadAPI is used. This is mostly for testing to avoid another regression in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a couple of comments; overall PR looks good.
google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/JobStatistics.java
Show resolved
Hide resolved
@@ -476,22 +476,29 @@ private BigQueryResult queryRpc( | |||
} | |||
|
|||
// Query finished running and we can paginate all the results | |||
if (results.getJobComplete() && results.getSchema() != null) { | |||
// Results should be read using the high throughput read API if sufficiently large. | |||
boolean shouldUseReadApi = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: shouldUseReadApi is very similar to the method: useReadAPI which is used in getSubsequentQueryResultsWithJob. In addition, even when shouldUseReadApi == true here, the useReadAPI() can return false in the subsequent getSubsequentQueryResultsWithJob call. Perhaps, changing the name to a negative condition is sufficient. E.g., shouldNotUseReadApi (or something else better).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think of resultsLargeEnoughForReadApi
?
Currently, the ReadAPI is being bypassed in the
executeSelect()
function when requests are sent using fast query. This change decides whether to use the ReadAPI based on the query result size, and enables the use of both fast query and ReadAPI together.This change also updates
queryRpc()
to use the table data from the first page of the query results instead of the empty results of the unfinished job.Finally, this change adds a subfield in the
QueryStatistics
field in the query response to keep track of whether or not the ReadAPI is used. This field is essentially only useful for testing to ensure that another regression is avoided in the future.Fixes #2764