Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request changes the visibility of BigQueryResultSetMetadata and its getField(int) method to public, adding Javadoc and corresponding unit tests. A review comment suggests improving the robustness of the newly public getField method by validating the column index and throwing a SQLException instead of allowing an IndexOutOfBoundsException to propagate.
| public Field getField(int sqlColumn) { | ||
| return this.schemaFieldList.get(sqlColumn - 1); | ||
| } |
There was a problem hiding this comment.
Since BigQueryResultSetMetadata is now a public class and getField(int) is a public method, it should robustly handle invalid column indices. In JDBC, column indices are 1-based, and passing an invalid index (e.g., 0, negative, or greater than the schema size) should throw a SQLException rather than letting a raw IndexOutOfBoundsException propagate.
public Field getField(int sqlColumn) throws SQLException {
if (sqlColumn < 1 || sqlColumn > this.schemaFieldList.size()) {
throw new SQLException("Column index out of bounds: " + sqlColumn);
}
return this.schemaFieldList.get(sqlColumn - 1);
}There was a problem hiding this comment.
Done — validated 1-based column bounds in getField(int) and threw BigQueryJdbcException (a SQLException subclass) when out of bounds, with unit test coverage.
|
@logachev PTAL when you have a chance — this exposes |
|
/gcbrun |
Make
BigQueryResultSetMetadataandgetField(int)publicso callers unwrappingResultSetMetaDataviaResultSetMetaData.unwrap(BigQueryResultSetMetadata.class)can inspect the underlying BigQueryFieldschema metadata (e.g.,Field.getMode()and elementStandardSQLTypeNameforREPEATEDcolumns) without package-private shims or reflection.