Skip to content

fix(bqjdbc): fix Long to java.sql.Time coercion#13035

Open
Neenu1995 wants to merge 3 commits intomainfrom
ns/annotate-deprecated
Open

fix(bqjdbc): fix Long to java.sql.Time coercion#13035
Neenu1995 wants to merge 3 commits intomainfrom
ns/annotate-deprecated

Conversation

@Neenu1995
Copy link
Copy Markdown
Contributor

@Neenu1995 Neenu1995 commented May 7, 2026

b/510853631

chore(bqjdbc): suppress deprecation warnings

  • Silenced Deprecation Warnings: Added @deprecated and @SuppressWarnings("deprecation") annotations to all mandated overridden methods in BigQueryBaseResultSet, BigQueryPreparedStatement, and BigQueryCallableStatement to satisfy the standard JDBC interface contract warning-free.
  • Unified Arrow Coercion (LongToTime): Refactored the Arrow microsecond parser to use new Time(value / 1000) to achieve a zero-overhead, warning-free conversion that fully preserves sub-second millisecond precision.
  • Fixed JSON Coercion Wall-Clock Shifts (FieldValueToTime): Introduced local timezone offset compensation arithmetic (millisOfDay - TimeZone.getDefault().getOffset()) to ensure the retrieved timezone-agnostic time-of-day matches the stored database value exactly, regardless of the client machine's timezone.
  • Fixed Timestamp Shifting (FieldValueToTimestamp & LongToTimestamp): Standardized both numeric timestamp parsers to use the timezone-agnostic Timestamp.from(instant) standard, preserving the exact UTC point in time and eliminating dual timezone shifts in non-UTC system timezones.
  • Modernized the Test Suite: Restructured and updated the expected assertions across multiple unit test classes (ArrowFormatType, FieldValueType, BigQueryArrowArrayOfPrimitives, BigQueryArrowStruct) to enforce these timezone-robust, high-precision, and compliant results.

@Neenu1995 Neenu1995 requested review from a team as code owners May 7, 2026 19:54
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 updates several JDBC methods in BigQueryBaseResultSet, BigQueryCallableStatement, and BigQueryPreparedStatement with @deprecated and @SuppressWarnings annotations to align with the JDBC specification. Additionally, it replaces a deprecated java.sql.Time constructor in BigQueryTypeCoercionUtility with a Calendar-based implementation. A review comment suggests using java.time.LocalTime and java.sql.Time.valueOf() instead of Calendar to avoid performance overhead during result set iteration, as Calendar is relatively expensive for high-frequency operations.

@Neenu1995 Neenu1995 changed the title chore(bqjdbc): suppress deprecation warnings fix(bqjdbc): fix Log to java.sql.Time coercion May 7, 2026
@Neenu1995 Neenu1995 changed the title fix(bqjdbc): fix Log to java.sql.Time coercion fix(bqjdbc): fix Long to java.sql.Time coercion May 7, 2026
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