Skip to content

Conversation

@danieljbruce
Copy link
Contributor

@danieljbruce danieljbruce commented Jan 16, 2026

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 types to generate all changes in this PR to types.d.ts. This automatically makes changes upstream to the createTable method adding the timestampPrecision property for fields. Then we write a system test that
makes 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

  • Adds a test showing how precision is specified for fields of non-TIMESTAMP type.
  • Adds a test showing how precision (timestampPrecision) is specified for TIMESTAMP type.

Additional Information

An alternative considered is that we would just allow the user to specify a precision value in their table schema instead of timestampPrecision and the timestampPrecision property would be invisible to the user. However, this is not how it is done in other languages like googleapis/java-bigquery#4014 and supporting timestampPrecision this way would complicate the codebase because we would need to exclude timestampPrecision from TableField and TableSchema interfaces 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:

  • table.setMetadata
  • bigquery.mergeSchemaWithRows
  • table.createSchemaFromString
  • all methods using the ITable, IQueryResponse, IJobStatistics2, IJobConfigurationLoad, IGetQueryResultsResponse, IExternalDataConfiguration interfaces

Next Steps

  • Add support for a SQL high precision data type, query parameterization, reading rows language value types, write API support and insert all support

@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: bigquery Issues related to the googleapis/nodejs-bigquery API. labels Jan 16, 2026
@danieljbruce danieljbruce changed the title Schema precision feat: Support createTable with TIMESTAMP fields that have Picosecond precision Jan 16, 2026
@danieljbruce danieljbruce marked this pull request as ready for review January 16, 2026 18:03
@danieljbruce danieljbruce requested review from a team as code owners January 16, 2026 18:03
@alvarowolfx
Copy link
Contributor

The discovery types are synced with an automation. We can merge this PR first #1550 instead of having such changes here.

Also we might want to rename this PR to something like test: exercise createTable with TIMESTAMP fields that have Picosecond precision since this doesn't add support for that, just exercises the feature. The feature itself is added via having the fields in sync with Discovery.

@alvarowolfx alvarowolfx added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jan 20, 2026
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jan 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: bigquery Issues related to the googleapis/nodejs-bigquery API. size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants