fix(bq jdbc): ensure getMoreResults() always moves the cursor#12353
Merged
fix(bq jdbc): ensure getMoreResults() always moves the cursor#12353
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors BigQueryStatement by moving the null check for parentJobId into the getNextJob method and removing it from getMoreResults. It also includes a refactor of connection URI constants and adds new integration tests to verify the behavior of getMoreResults for SELECT, INSERT, and TCL statements. A review comment suggests using try-with-resources in the new test code to ensure robust resource management and prevent potential leaks.
...-cloud-bigquery-jdbc/src/test/java/com/google/cloud/bigquery/jdbc/it/ITBigQueryJDBCTest.java
Show resolved
Hide resolved
keshavdandeva
approved these changes
Apr 1, 2026
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.
Statement.execute()method when running single-statement that is not properly handlinggetMoreResults(). For these queries there is noparentJob, so it always skips any meaningful action (close current statement, try to get next job, reset fields if no next job). Moving parentJob non-null check togetNextJob()method. That way it properly resets fields.Without that, JDBC standard way of fetching all results ((stmt.getMoreResults() == false) && (stmt.getUpdateCount() == -1))
results in infinite loop.
Added 3 tests to validate this behavior for 3 types: TCL/DDL/SELECT.