feat(bigquery-jdbc): support picosecond timestamp in ResultSetMetaData and DatabaseMetaData - #14358
feat(bigquery-jdbc): support picosecond timestamp in ResultSetMetaData and DatabaseMetaData#14358keshavdandeva wants to merge 1 commit into
ResultSetMetaData and DatabaseMetaData#14358Conversation
…ta` and `DatabaseMetaData`
There was a problem hiding this comment.
Code Review
This pull request introduces support for picosecond-precision timestamps in the BigQuery JDBC driver when the feature is enabled. It updates BigQueryDatabaseMetaData and BigQueryResultSetMetadata to correctly map and describe picosecond timestamp columns as VARCHAR types with a precision of 32 and scale of 12, while returning String as the column class name. Additionally, the default display size for standard TIMESTAMP columns has been increased from 16 to 26. Extensive unit tests have been added to verify these metadata behaviors under different configurations. There are no review comments to address, so no further feedback is provided.
| this.schemaFieldList = schemaFieldList; | ||
| this.columnCount = schemaFieldList.size(); | ||
| this.statement = statement; | ||
| this.enableTimestampPicos = |
There was a problem hiding this comment.
We should be able to change constructor parameter to be BigQueryStatement. Either way we don't support any other type
| return false; | ||
| } | ||
| Field field = getField(sqlColumn); | ||
| return field.getMode() != Mode.REPEATED && BigQueryTemporalUtility.isPicosecondTimestamp(field); |
There was a problem hiding this comment.
Should we move this check to isPicosecondTimestamp()?
b/556665374
This PR implements metadata reflection for picosecond timestamps across
ResultSetMetaDataandDatabaseMetaData.getColumns()whenEnableTimestampPicosis active.Key Changes
Result Set Metadata (
BigQueryResultSetMetadata):Types.VARCHAR, type nameTIMESTAMP_PICOSECONDS,String.class, display size32, precision32, and scale12when enabled.enableTimestampPicosonce during initialization.getColumnDisplaySizefallback from legacy16to spec-compliant26("YYYY-MM-DD HH:MM:SS.ffffff").Database Metadata (
BigQueryDatabaseMetaData):mapBigQueryTypeToJdbcto returnColumnTypeInfo(Types.VARCHAR, TIMESTAMP_PICOSECONDS, 32, 12, null)for non-repeated picosecond timestamp fields whenconnection.isEnableTimestampPicos()is active.Types.ARRAY.Centralized Constant (
BigQueryTemporalUtility):TIMESTAMP_PICOSECONDS_TYPE_NAME = "TIMESTAMP_PICOSECONDS"to eliminate duplicate magic string literals across metadata components.Testing & Verification:
BigQueryResultSetMetadataTestandBigQueryDatabaseMetaDataTestverifying metadata reflection for enabled, disabled, repeated array, and standard timestamp columns.