Skip to content

fix(bigquery-jdbc): correct isLast() with setMaxRows, guard Arrow getters, decode Arrow batches without copying - #14951

Open
keshavdandeva wants to merge 3 commits into
mainfrom
fix/jdbc-resultset-maxrows-cursor-decoding
Open

keshavdandeva wants to merge 3 commits into
mainfrom
fix/jdbc-resultset-maxrows-cursor-decoding

Conversation

@keshavdandeva

Copy link
Copy Markdown
Contributor

b/583949767

This PR fixes three result-set issues:

  • isLast() was never true when setMaxRows was larger than the result (JSON and Arrow). A shared helper now caps the total at maxRows.
  • Arrow getters called off a row now throw SQLException. Before next() they threw IndexOutOfBoundsException, and after the last row they returned a stale value.
  • Arrow batches are now decoded straight from the ByteString, with no heap byte[] copy.

@keshavdandeva
keshavdandeva requested review from a team as code owners November 9, 2026 23:02

@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 optimizes Arrow batch deserialization by reading directly from ByteString, adds row-position validation to BigQueryArrowResultSet.getObjectInternal, and introduces a helper method getEffectiveTotalRows to cap the total rows correctly. The feedback recommends using asReadOnlyByteBuffer() with a custom ReadableByteChannel to achieve true zero-copy deserialization instead of Channels.newChannel, and moving the row-position guard check to the beginning of getObjectInternal to ensure it also covers nested columns.

This branch has not been deployed

No deployments
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.

1 participant