GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(bigquery): add Storage Read API slow-path fallback for row-based query() by jinseopkim0 · Pull Request #14389 · googleapis/google-cloud-java

Conversation

@jinseopkim0

@jinseopkim0 jinseopkim0 commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

This PR implements slow-path execution fallback for row-based queries requesting Arrow results format (QueryResultsFormat.ARROW). When queries cannot be evaluated via the fast query path (such as queries writing to destination tables or exceeding fast-path limits), BigQuery job execution is triggered and table results are streamed via the BigQuery Storage Read API in Arrow format.

Follow-up PR stacked on top of #14380.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

gemini-code-assist[bot] reacted with eyes emoji
All reactions
  • 👀 1 reaction
@jinseopkim0
jinseopkim0 added this pull request to stack #14379 September 15, 2026 14:42
gemini-code-assist[bot]
gemini-code-assist Bot reviewed Sep 15, 2026
View reviewed changes

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

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.

Code Review

This pull request implements a fallback mechanism (queryFallbackArrow) to support the Arrow query results format for slow-path query executions by executing the query job and streaming the results via the BigQuery Storage Read API. The feedback recommends passing the resolved destinationTable instead of null to TableDataPageFetcher to prevent potential NullPointerExceptions, and optimizing the calculation of rowsInPage to avoid inefficiently copying the entire first page of results into an ImmutableList just to retrieve its size.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread java-bigquery/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryImpl.java
.setTotalRows(numDmlAffectedRows != null ? numDmlAffectedRows : 0L)
.setPageNoSchema(
new PageImpl<>(
new TableDataPageFetcher(null, schema, getOptions(), null, optionMap(options)),

@gemini-code-assist gemini-code-assist Bot Sep 15, 2026

Copy link
Copy Markdown
Contributor

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.

medium

Instead of passing null as the first argument (TableId) to TableDataPageFetcher, pass destinationTable. Since destinationTable is guaranteed to be non-null at this point, passing it ensures that the fetcher is correctly initialized and avoids potential NullPointerExceptions if getNextPage() is ever invoked.

Suggested change
new TableDataPageFetcher(null, schema, getOptions(), null, optionMap(options)),
new TableDataPageFetcher(destinationTable, schema, getOptions(), null, optionMap(options)),

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread java-bigquery/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryImpl.java
Comment on lines +3144 to +3146
List<FieldValueList> firstPageRows =
firstPage != null ? ImmutableList.copyOf(firstPage.getValues()) : ImmutableList.of();
long rowsInPage = (long) firstPageRows.size();

@gemini-code-assist gemini-code-assist Bot Sep 15, 2026

Copy link
Copy Markdown
Contributor

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.

medium

Copying the entire first page of results into a new ImmutableList via ImmutableList.copyOf(firstPage.getValues()) just to get its size is inefficient, especially for large page sizes (e.g., up to 10,000 rows). Instead, we can check if the values are already a Collection to get the size in $O(1)$ time, or use Iterables.size() to avoid copying.

    long rowsInPage = 0;
    if (firstPage != null) {
      Iterable<FieldValueList> values = firstPage.getValues();
      rowsInPage = values instanceof java.util.Collection
          ? ((java.util.Collection<?>) values).size()
          : com.google.common.collect.Iterables.size(values);
    }

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread java-bigquery/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryImpl.java
firstPage != null
? firstPage
: new PageImpl<>(
new TableDataPageFetcher(null, schema, getOptions(), null, optionMap(options)),

@gemini-code-assist gemini-code-assist Bot Sep 15, 2026

Copy link
Copy Markdown
Contributor

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.

medium

Instead of passing null as the first argument (TableId) to TableDataPageFetcher, pass destinationTable. Since destinationTable is guaranteed to be non-null at this point, passing it ensures that the fetcher is correctly initialized and avoids potential NullPointerExceptions if getNextPage() is ever invoked.

Suggested change
new TableDataPageFetcher(null, schema, getOptions(), null, optionMap(options)),
new TableDataPageFetcher(destinationTable, schema, getOptions(), null, optionMap(options)),

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@jinseopkim0
feat(bigquery): add Storage Read API slow-path fallback for row-based…
95df637
… query()
@jinseopkim0
jinseopkim0 force-pushed the feat-bigquery-arrow-query-slowpath-fallback branch from 85621b7 to 95df637 Compare September 16, 2026 18:42
@jinseopkim0

jinseopkim0 commented Sep 16, 2026

Copy link
Copy Markdown
Contributor Author

Closing in favor of fresh duplicate PR stacked on #14405.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jinseopkim0 jinseopkim0 closed this Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer
@gemini-code-assist gemini-code-assist[bot] gemini-code-assist[bot] left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@jinseopkim0
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.