Repository navigation
fix(bigquery-jdbc): normalize setTime from Calendar zone to JVM zone - #14660
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a new utility method convertTimeToCalendar in BigQueryTemporalUtility to convert and normalize java.sql.Time parameters using a target Calendar's timezone, and updates BigQueryCallableStatement and BigQueryPreparedStatement to use it. Unit tests have also been expanded to cover these cross-timezone conversions. The feedback suggests refactoring convertTimeToCalendar to use legacy Calendar manipulation instead of java.time APIs to ensure proper handling of Daylight Saving Time (DST).
keshavdandeva
force-pushed
the
jdbc/fix-set-time-calendar
branch
from
October 15, 2026 14:52
ca339b7 to
55aa784
Compare
Neenu1995
approved these changes
Oct 15, 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.
b/565818805
Summary
Fixes
PreparedStatement.setTime(..., Calendar)andCallableStatement.setTime(..., Calendar)applying theCalendartimezone offset in the wrong direction.Problem
BigQueryTemporalUtility.convertTimeWithCalendar(Time, Calendar)shifts wall-clock time fields from the JVM default timezone into the targetCalendar's timezone (the read-side direction used byCallableStatement.getTime(..., Calendar)). Calling it insetTime(..., Calendar)shifted the offset in the opposite direction beforeBigQueryParameterHandlerformatted theTimein the JVM default timezone.Changes
BigQueryTemporalUtility.convertTimeToCalendar(Time, Calendar)(mirroringconvertDateToCalendar) to extract local time fields in the providedCalendar's timezone and normalize them to1970-01-01in the JVM default timezone.BigQueryPreparedStatement.setTime(int, Time, Calendar)andBigQueryCallableStatement.setTime(String, Time, Calendar)to callconvertTimeToCalendar.BigQueryTemporalUtilityTest,BigQueryPreparedStatementSettersTest, andBigQueryCallableStatementTest.