Skip to content

feat: Support google.protobuf.Timestamp values for the storage write API#439

Closed
adw-okamu wants to merge 8 commits into
goccy:mainfrom
adw-okamu:feat/support-protobuf-timestamp-storage-write-api
Closed

feat: Support google.protobuf.Timestamp values for the storage write API#439
adw-okamu wants to merge 8 commits into
goccy:mainfrom
adw-okamu:feat/support-protobuf-timestamp-storage-write-api

Conversation

@adw-okamu

Copy link
Copy Markdown

Summary

upstream goccy/bigquery-emulator#416 の変更を取り込み、Storage Write API で google.protobuf.Timestamp 型の値をサポートします。

BigQuery は TIMESTAMP カラムに対して int64 だけでなく google.protobuf.Timestamp も受け付けますが(参考)、従来のエミュレータではこの形式を送信するとパニックが発生していました。

変更内容

  • server/storage_handler.go: decodeProtoReflectValuegoogle.protobuf.Timestamp / google_protobuf_Timestamp の検出ロジックを追加。dynamicpb.Message を Marshal/Unmarshal のラウンドトリップで time.Time に変換する decodeTimestamp 関数を追加
  • internal/contentdata/repository.go: AddTableData 内のタイムスタンプ処理を columnValue ヘルパー関数にリファクタリング
  • internal/types/types.go: Format 内のインライン処理を formatCell 関数に抽出。UnixNano() / int64(time.Microsecond)UnixMicro() に改善
  • server/storage_test.go: TestStorageWriteDynamicDescriptor テストを追加(ゼロ値・現在時刻のラウンドトリップ検証)

除外した変更

upstream PR #416 には RECORD カラム内の TIMESTAMP 処理の再帰対応も含まれていましたが、この機能は未マージの goccy/go-zetasqlite#232 に依存するため、今回は除外しています。依存先がマージされた後に別途対応予定です。

Test plan

  • go build ./... ビルド成功
  • TestStorageWriteDynamicDescriptor PASS(ゼロ値タイムスタンプ + 現在時刻のラウンドトリップ)
  • TestStorageWrite 既存テスト PASS(pending / committed / default サブテスト)

Generated with Claude Code

coxley and others added 8 commits February 18, 2026 23:22
Remove RECORD column handling for nested timestamps as it depends on
go-zetasqlite#232 which is not yet merged. The core
google.protobuf.Timestamp support for the storage write API is retained.

Co-Authored-By: Claude <noreply@anthropic.com>
RECORD handling was removed, so the function no longer recurses.

Co-Authored-By: Claude <noreply@anthropic.com>
@adw-okamu adw-okamu closed this Feb 18, 2026
@adw-okamu adw-okamu deleted the feat/support-protobuf-timestamp-storage-write-api branch February 18, 2026 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants