Skip to content

feat(bigquery-jdbc): implement JDBC getObject type coercion support#13257

Open
Neenu1995 wants to merge 3 commits into
mainfrom
fix-date-getObjects
Open

feat(bigquery-jdbc): implement JDBC getObject type coercion support#13257
Neenu1995 wants to merge 3 commits into
mainfrom
fix-date-getObjects

Conversation

@Neenu1995
Copy link
Copy Markdown
Contributor

@Neenu1995 Neenu1995 commented May 22, 2026

b/515411678

Finalizes JDBC 4.2 support by fully implementing standard ResultSet.getObject(int, Class<T>) and ResultSet.getObject(String, Class<T>) retrieval.

Key Changes

  • Unified Retrieval: Centralized standard getObject logic in BigQueryBaseResultSet to leverage BigQueryTypeCoercionUtility.
  • Clean Up: Removed redundant, non-functional stub method overrides in BigQueryNoOpsResultSet.
  • Expanded Coercions: Added support for converting standard wrapper types (Integer, Long, Double, Float) and String to BigDecimal in BigQueryTypeCoercionUtility.
  • Test Coverage: Added robust test cases in BigQueryJsonResultSetTest and BigQueryArrowResultSetTest verifying standard types (java.time types, Booleans, Numbers, and BigDecimal) and confirming that invalid coercions raise SQLException as expected.

@Neenu1995 Neenu1995 requested review from a team as code owners May 22, 2026 20:18
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 implements the getObject(..., Class type) method in BigQueryBaseResultSet and introduces several new type coercions in BigQueryTypeCoercionUtility, primarily for Java 8 date/time types and BigDecimal. The review identifies a missing import for Instant and potential timezone inconsistencies when converting Timestamp to LocalDateTime. Additionally, the feedback suggests simplifying LocalTime conversion, wrapping runtime exceptions in SQLException for JDBC compliance, and fixing a precision issue in the test assertions.

@Neenu1995 Neenu1995 changed the title feat(bigquery-jdbc): implement JDBC getObject type co ercion support feat(bigquery-jdbc): implement JDBC getObject type coercion support May 22, 2026

public static Stream<Arguments> successfulCoercionCases() {
return Stream.of(
Arguments.of("fourteenth", LocalDate.class, LocalDate.of(2020, 1, 15)),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also add regular Date/Timestamp etc?

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.

2 participants