Skip to content

fix(bqjdbc): pass rowsInPage with TableResult#13238

Open
Neenu1995 wants to merge 4 commits into
mainfrom
impl-maxresults
Open

fix(bqjdbc): pass rowsInPage with TableResult#13238
Neenu1995 wants to merge 4 commits into
mainfrom
impl-maxresults

Conversation

@Neenu1995
Copy link
Copy Markdown
Contributor

@Neenu1995 Neenu1995 commented May 20, 2026

b/511229401

This PR introduces the rowsInPage metadata to TableResult and ensures it is populated for all pages (both the first page and subsequent pages fetched via pagination).

Previously, metadata about the number of rows in the page was not easily accessible or propagated across multiple paginated requests (e.g., when calling getNextPage()). This change:

  1. Adds a rowsInPage field and builder method to the @AutoValue TableResult class.
  2. Populates rowsInPage during initial page creation in BigQueryImpl and empty results in Job.java.
  3. Updates TableResult.getNextPage() to calculate the size of values for subsequent pages via Iterables.size (which is $O(1)$ for materialized lists) and sets it on the returned TableResult pages.
  4. Updates unit test assertions in TableResultTest.java and SerializationTest.java to verify that rowsInPage is populated and propagated correctly.

Key Changes

  • TableResult.java: Added getRowsInPage(), builder method setRowsInPage(), and updated getNextPage() to pass down the calculated row count for the next page.
  • BigQueryImpl.java: Set rowsInPage on initial query results page creation.
  • TableResultTest.java: Added assertions to verify that rowsInPage is correctly populated for both the first page and subsequent pages.

@Neenu1995 Neenu1995 requested review from a team as code owners May 20, 2026 14:41
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a 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 introduces a rowsInPage field to the TableResult class, allowing for more accurate tracking of the number of rows in a specific results page. This field is integrated into the JDBC driver's read ratio calculation and various TableResult construction points. Feedback includes a critical fix for the equals method to use Objects.equals for string comparison of queryId and a suggestion to ensure rowsInPage is populated during pagination for consistency.

Neenu1995 and others added 3 commits May 20, 2026 11:51
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@Neenu1995 Neenu1995 requested a review from lqiu96 May 20, 2026 18:52
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