Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors exception handling across the BigQuery JDBC driver, replacing BigQueryJdbcRuntimeException with BigQueryJdbcException to align with standard JDBC practices. It also standardizes InterruptedException handling by consistently restoring the thread's interrupted status and wrapping it appropriately. The review feedback identifies a compilation error in BigQueryDaemonPollingTask due to an invalid logger method overload, suggests preserving descriptive error messages when wrapping InterruptedException in BigQueryJdbcOpenTelemetry, and recommends ensuring an exception is thrown during connection close if the thread was interrupted.
This branch has not been deployed
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.
Thread.currentThread().interrupt()) on everyInterruptedExceptioncatch in Connection, Statement, PreparedStatement, ResultSet,DatabaseMetaData and OpenTelemetry tracing.
BigQueryJdbcExceptioninstead of uncheckedBigQueryJdbcRuntimeExceptionfrom public JDBC methods (
execute*,executeBatch,getMoreResults,next,commit,rollback,close, Write API batch), as JDBC requiresSQLException.IllegalStateExceptionwithBigQueryJdbcExceptionincheckClosed(),checkIfEnabledSession(), andcommit()/rollback()when no transaction is active.Methods that call these checks (
getDefaultDataset,getLocation,getAuthProperties,getAutoCommit, Statement constructors) now declarethrows SQLException.and
ResultSet.next()wraps it a single time viabackgroundFetchError(), keepingthe
BigQueryExceptioncause so its error details stay available.Connection.close(): errors fromabortSession()and interrupts while waitingfor executors to shut down are collected as suppressed exceptions and rethrown as
BigQueryJdbcException.isClosedis now set even when close throws.throws InterruptedExceptionfromrunQuery(), which also removes theduplicate catch blocks in its callers.
exception with its stack trace and restores the interrupt flag.
withTracingno longer turns checked exceptions into unchecked ones.BigQueryJdbcRuntimeException(String, InterruptedException)constructor.SQLException/BigQueryJdbcException.