feat: Support createTable with TIMESTAMP fields that have Picosecond precision #1588
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
For TIMESTAMP type fields in the table schema we can now specify timestampPrecision property so that the TIMESTAMP field can have Picosecond precision.
To support this we ran
npm run typesto generate all changes in this PR totypes.d.ts. This automatically makes changes upstream to thecreateTablemethod adding thetimestampPrecisionproperty for fields. Then we write a system test thatmakes use of the new property to verify it works as intended.
Impact
Allows users to create tables with TIMESTAMP fields that have picosecond precision.
Testing
Additional Information
An alternative considered is that we would just allow the user to specify a
precisionvalue in their table schema instead of timestampPrecision and thetimestampPrecisionproperty would be invisible to the user. However, this is not how it is done in other languages like googleapis/java-bigquery#4014 and supportingtimestampPrecisionthis way would complicate the codebase because we would need to excludetimestampPrecisionfromTableFieldandTableSchemainterfaces which would introduce a lot of changes and complexity.The new timestampPrecision field affects ITableFieldSchema which affects ITableSchema which affects TableSchema and TableMetadata. This means the following methods now support the new timestampPrecision property too:
Next Steps