feat: Support google.protobuf.Timestamp values for the storage write API#439
Closed
adw-okamu wants to merge 8 commits into
Closed
feat: Support google.protobuf.Timestamp values for the storage write API#439adw-okamu wants to merge 8 commits into
adw-okamu wants to merge 8 commits into
Conversation
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>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
upstream goccy/bigquery-emulator#416 の変更を取り込み、Storage Write API で
google.protobuf.Timestamp型の値をサポートします。BigQuery は TIMESTAMP カラムに対して
int64だけでなくgoogle.protobuf.Timestampも受け付けますが(参考)、従来のエミュレータではこの形式を送信するとパニックが発生していました。変更内容
server/storage_handler.go:decodeProtoReflectValueにgoogle.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 ./...ビルド成功TestStorageWriteDynamicDescriptorPASS(ゼロ値タイムスタンプ + 現在時刻のラウンドトリップ)TestStorageWrite既存テスト PASS(pending / committed / default サブテスト)Generated with Claude Code