Repository navigation
Conversation
…bleResult.iterateAll()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary & Bottleneck
In
java-bigquery/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/TableResult.java,TableResult.iterateAll()delegates togetPageNoSchema().iterateAll(), which usesPageImpl.PageIterator.PageImpl.PageIteratoronly callscurrentPage.getNextPage()synchronously after the caller has exhausted all rows of the current page (!currentPageIterator.hasNext()).getNextPage().Changes
java-bigquery/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/TableResult.java:PrefetchingPageIteratorinTableResult.iterateAll()backed by a shared daemon thread pool (PREFETCH_EXECUTOR).currentPage.hasNextPage()istrue, submitcurrentPage.getNextPage()asynchronously so the next page is fetched and deserialized in parallel with the caller consuming the current page.hasNextPage() == false) or forTableResult.getValues().ExecutionExceptioncauses when advancing to the prefetched page.Expected Impact
TableResult.iterateAll()across both REST (tabledata.list) and Storage Read API (ArrowQueryPageFetcher) pagination paths.Verification
java-bigquery/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/TableResultTest.javaverifying asynchronous background prefetch during Page 0 iteration, 1-page lookahead bounding across a 3-page chain, and exception propagation at the page boundary.mvn test -pl java-bigquery/google-cloud-bigquery -Dtest=TableResultTest,ArrowQueryPageFetcherTest,JobTest,BigQueryImplTest(191 tests run, 0 failures).