feat(bigquery-jdbc): add picosecond precision support for TIMESTAMP - #14038
feat(bigquery-jdbc): add picosecond precision support for TIMESTAMP#14038keshavdandeva wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for 12-digit picosecond precision for TIMESTAMP columns in the BigQuery JDBC driver, controlled by a new connection property EnableTimestampPicos. It updates result set implementations, connection settings, statement processing, and metadata to handle picosecond precision when enabled. One high-severity issue was identified where the default value for the EnableTimestampPicos property is set to the string "false" instead of "0", which could cause parsing errors during connection initialization.
logachev
left a comment
There was a problem hiding this comment.
Can you update integration tests too? Probably tests that do format validation + tests your wrote a few weeks/months ago for picoseconds
| } | ||
|
|
||
| private boolean isTimestampPicosEnabled() { | ||
| return this.statement instanceof BigQueryStatement |
There was a problem hiding this comment.
nit: maybe using isWrapperFor/unwrap methods?
b/544839231
This PR introduces support for picosecond precision (up to 12 fractional digits) when reading BigQuery
TIMESTAMPcolumns, building on top of #14037Overview
To maintain strict backwards compatibility, picosecond precision is disabled by default and activated via the new
EnableTimestampPicosconnection property:displaySize=26, precision=26, scale=6),getString(),getTimestamp(), andgetObject().displaySize=32, precision=32, scale=12inResultSetMetaDataand preserves full 12-digit picosecond precision ingetString().Changes Made
Configuration:
EnableTimestampPicosconnection property inBigQueryConnectionandDataSource.Arrow Storage Engine:
ReadSessioncreation inBigQueryStatementto explicitly requestTIMESTAMP_PRECISION_PICOSwhenEnableTimestampPicosis active.Text -> TimestampandString -> TimestampinBigQueryTypeCoercionUtilityusingBigQueryTemporalUtility::boxTimestampsogetObject()andgetTimestamp()seamlessly handle Arrow picosecondVarCharVectorcolumns.JDBC Metadata:
BigQueryResultSetMetadatato reportdisplaySize=32,precision=32, andscale=12whenEnableTimestampPicosis active and the column schema precision is 12.Temporal Utilities & API Safety:
boxTimestamp(): Gracefully down-casts 12-digit picosecond strings to 9 digits (nanoseconds) forjava.sql.Timestamp, which maxes out at nanosecond precision and would otherwise throw aDateTimeParseException.formatTimestampStringFromIso(): Standardized ISO-8601 formatting supporting both'T'/'Z', SQL space-delimited (' '/' UTC'), and raw strings.Testing
BigQueryArrowResultSetTestverifyinggetString(),getTimestamp(), andgetObject()against picosecondTextcolumns.BigQueryResultSetMetadataTestverifying precision, scale, and display size with picoseconds enabled and disabled.ArrowFormatTypeBigQueryCoercionUtilityTestandBigQueryTemporalUtilityTest.