Skip to content

fix(bigquery): raise when an Arrow batch arrives before its schema - #18791

Merged
ohmayr merged 1 commit into
mainfrom
fix/bigquery-arrow-batch-without-schema
Oct 20, 2026
Merged

ohmayr merged 1 commit into
mainfrom
fix/bigquery-arrow-batch-without-schema

Conversation

@ohmayr

@ohmayr ohmayr commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Raises an error when an Arrow record batch arrives before its schema. Before, download_arrow_from_job() skipped such batches, so rows could go missing from Arrow query results without any error.

The skip has been there since Arrow support was added in #18027, so this fixes it on main on its own. #18651 (which reviewers flagged it on) will rebase on top of this.

  • Raises ValueError for a batch without a schema in the inline jobs.query first page.
  • Raises ValueError for a batch without a schema in the ReadRows stream.
  • Adds unit tests for both cases.

download_arrow_from_job() skipped record batches that arrived before
any Arrow schema, in both the inline first page and the ReadRows
stream, so rows could go missing without an error. Raise ValueError
instead. Normal responses always send the schema first, so this only
fires on a malformed response.
@ohmayr
ohmayr requested review from a team as code owners October 20, 2026 20:05
@ohmayr
ohmayr requested review from julianxu-goog and removed request for a team October 20, 2026 20:05

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

Copy link
Copy Markdown
Contributor

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 updates the Arrow query downloading logic to explicitly raise a ValueError if an Arrow record batch is received before its schema is available, rather than silently ignoring it. It also adds corresponding unit tests to verify this behavior. There are no review comments, so I have no additional feedback to provide.

@ohmayr
ohmayr requested a review from tswast October 20, 2026 20:10

@tswast tswast left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@ohmayr
ohmayr merged commit 7944a4c into main Oct 20, 2026
54 checks passed
@ohmayr
ohmayr deleted the fix/bigquery-arrow-batch-without-schema branch October 20, 2026 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants