Skip to content

feat(go): use option for optional fields#3202

Merged
chaokunyang merged 22 commits intoapache:mainfrom
chaokunyang:go_option_for_optional_fields
Jan 26, 2026
Merged

feat(go): use option for optional fields#3202
chaokunyang merged 22 commits intoapache:mainfrom
chaokunyang:go_option_for_optional_fields

Conversation

@chaokunyang
Copy link
Collaborator

@chaokunyang chaokunyang commented Jan 25, 2026

Why?

Align Go codegen/serialization with xlang optional field semantics and add cross-language coverage for optional IDL types.

What does this PR do?

  • Generate Go optional fields using optional.Optional[T] (including decoder/encoder codegen, struct metadata, and type resolution) instead of pointers where supported.
  • Add optional-types IDL schema and cross-language roundtrip tests for Java, Go, Python, Rust, and C++ integration tests.
  • Update C++ timestamp serialization to microsecond precision per spec and expand field-config macro support.
  • Adjust Python xlang struct fingerprinting for user-defined types and add xlang byte-array read/write helpers.
  • Ignore generated optional-types artifacts in integration test fixtures.
  • Make struct object always addressable by copy unaddressable struct into a temp object to remove reflect from whole codepath

Related issues

Closes #3196

Does this PR introduce any user-facing change?

  • Does this PR introduce any public API change?
  • Does this PR introduce any binary protocol compatibility change?

Benchmark

@chaokunyang chaokunyang force-pushed the go_option_for_optional_fields branch from 585f9e3 to 2a3a268 Compare January 26, 2026 03:07
@chaokunyang chaokunyang force-pushed the go_option_for_optional_fields branch from cf0e71c to 5d28d41 Compare January 26, 2026 11:36
@chaokunyang chaokunyang force-pushed the go_option_for_optional_fields branch from 27eaa15 to 1c575a4 Compare January 26, 2026 15:22
@chaokunyang chaokunyang force-pushed the go_option_for_optional_fields branch from 378e058 to cef791d Compare January 26, 2026 15:47
@chaokunyang chaokunyang force-pushed the go_option_for_optional_fields branch from 6aefdea to 5a07e2b Compare January 26, 2026 16:34
@chaokunyang chaokunyang force-pushed the go_option_for_optional_fields branch 2 times, most recently from 58a8ba2 to b26bd8b Compare January 26, 2026 16:49
@chaokunyang chaokunyang force-pushed the go_option_for_optional_fields branch from b26bd8b to a3dbaa5 Compare January 26, 2026 16:54
@chaokunyang chaokunyang merged commit 4b02fc5 into apache:main Jan 26, 2026
62 checks passed
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.

[Compiler][Go] use optional for nullable fields in go

2 participants