Skip to content

feat(bigquery-jdbc): implement parameter setters in PreparedStatement#13792

Open
Neenu1995 wants to merge 3 commits into
mainfrom
ps-part1-setters
Open

feat(bigquery-jdbc): implement parameter setters in PreparedStatement#13792
Neenu1995 wants to merge 3 commits into
mainfrom
ps-part1-setters

Conversation

@Neenu1995

@Neenu1995 Neenu1995 commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

b/535194644

  • Parameter Setter Overloads (BigQueryPreparedStatement.java):
    • Implemented missing JDBC parameter setters: setShort, setByte, setInt, setLong, setFloat, setDouble, setBigDecimal, setBoolean, setString, setBytes, setObject, and setNull.
    • Delegates parameter binding to BigQueryParameterHandler with correct Java type metadata.
  • Transport-Layer Value Widening (BigQueryParameterHandler.java):
    • Added value widening in configureParameters(...) when constructing QueryParameterValue:
      • Widens Short, Byte, and BigInteger $\rightarrow$ Long for StandardSQLTypeName.INT64.
      • Widens Float $\rightarrow$ Double for StandardSQLTypeName.FLOAT64.
    • Resolves runtime IllegalArgumentException: Type INT64 incompatible with java.lang.Short during query execution.
  • JDBC Metadata Preservation (BigQueryJdbcTypeMappings.java):
    • Retained standard mappings (Types.SMALLINT $\rightarrow$ java.lang.Short, Types.TINYINT $\rightarrow$ java.lang.Byte).
    • Ensures ParameterMetaData.getParameterClassName() remains 100% compliant with JDBC standards.

@Neenu1995
Neenu1995 requested review from a team as code owners July 16, 2026 16:37

@gemini-code-assist gemini-code-assist Bot left a comment

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.

Code Review

This pull request implements several previously unsupported JDBC setter methods in BigQueryPreparedStatement, including setNull, setShort, setBytes, setObject, and setArray, along with corresponding type mappings in BigQueryJdbcTypeMappings and comprehensive unit and integration tests. The review feedback highlights opportunities to improve type consistency by mapping Types.SMALLINT and Types.TINYINT to Short.class and Byte.class respectively, propagating SQLException in setNull instead of silently swallowing it, and simplifying setShort to use Short.class directly.

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