This repository was archived by the owner on Mar 5, 2026. It is now read-only.
feat: Add high precision Picosecond timestamp support for write calls#654
Merged
Conversation
Modify the system test in `timestamp_output_format.ts` to use `table.request` instead of `table.getRows`. This ensures that we are checking the raw data returned by the server, bypassing any unreleased changes in the BigQuery library. The test now verifies high-precision timestamps by inspecting the raw JSON response from the `/data` endpoint. Co-authored-by: danieljbruce <8935272+danieljbruce@users.noreply.github.com>
Added a new system test case to `managed_writer_client_test.ts` that verifies the ability to write timestamps with picosecond precision. The test creates a new table with a schema specifying `timestampPrecision: 12` and writes a row with a high-precision timestamp string. This test helps ensure that the BigQuery Storage Write API and the associated adaptation logic correctly handle picosecond precision timestamps. Co-authored-by: danieljbruce <8935272+danieljbruce@users.noreply.github.com>
alvarowolfx
approved these changes
Feb 25, 2026
| options['formatOptions.timestampOutputFormat'] = timestampOutputFormat; | ||
| options['formatOptions.useInt64Timestamp'] = useInt64Timestamp; | ||
|
|
||
| await new Promise<void>((resolve, reject) => { |
Contributor
There was a problem hiding this comment.
add a TODO to use the latest of nodejs-bigquery once picosecond support arrives there. Felt odd to see usage of .request here, but then I figure out was due to support to picosecond not here yet.
| type?: string; | ||
|
|
||
| /** | ||
| * [Optional] The precision for TIMESTAMP fields. 6 for microsecond, 12 for picosecond. |
Contributor
There was a problem hiding this comment.
nit: 9 for nanoseconds ?
Contributor
Author
There was a problem hiding this comment.
The backend expects a 6 or a 12.
Co-authored-by: Alvaro Viebrantz <aviebrantz@google.com>
…is/nodejs-bigquery-storage into picos-timestamp-feature
…is/nodejs-bigquery-storage into picos-timestamp-feature
…is/nodejs-bigquery-storage into picos-timestamp-feature
…is/nodejs-bigquery-storage into picos-timestamp-feature
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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 write calls with the grpc client this PR adds code changes that allow users to write rows that have high precision timestamp data. Most of the changes just require changes to the plumbing to ensure the timestamp precision property is used and the type mappings are correct when we want to preserve these high precision strings.
Impact
Allows users to write rows that have high precision timestamps.
Testing
A new system test does a write and then confirms with a read that the write worked correctly.
Additional Information
Files changed:
arrow.proto,avro.proto,storage.proto,stream.proto,table.proto,protos.d.ts,protos.js,protos.jsonwere all added just from running a bazel command in googleapis-gen and copied over directly.src/adapt/proto.ts: This is the code that ensures the row gets mapped to a string instead of an int so that it doesn't lose precision.src/adapt/schema.ts: This code ensures the storage schema has the timestampPrecision: 12 data if that data is provided in the table schema so that proto.ts knows when to map row timestamp data to a string before writing.managed_writer_client_test.ts: Added a test that does a write with the client for a row with high timestamp precision and then immediately does a read to ensure the write was done for the timestamp with high precision.