You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "Eliaaazzz (via GitHub)" <gi...@apache.org> on 2026/09/17 13:45:12 UTC
[I] [Bug]: Go SDK row coder encodes negative INT32 schema fields as 10 byte varints that Java and Python reject [beam]
Eliaaazzz opened a new issue, #40159:
URL: https://github.com/apache/beam/issues/40159
### What happened?
The Go SDK reflection row coder encodes `int32` struct fields with `EncodeVarInt(rv.Int())`, the signed 64 bit varint, so a negative value takes 10 bytes: `-1` becomes `ff ff ff ff ff ff ff ff ff 01` (`sdks/go/pkg/beam/core/graph/coder/row_encoder.go`, the `reflect.Int32` case shared with the other int kinds).
The other SDKs encode the INT32 schema type as the varint of the unsigned 32 bit form of the value, 5 bytes at most:
- Java `VarIntCoder` calls `VarInt.encode(int)`, which masks with `0xFFFFFFFFL`, so `-1` is `ff ff ff ff 0f`. `VarInt.decodeInt` throws `varint overflow` for the Go bytes because they decode to a negative long.
- Python `VarInt32Coder` writes `v & 0xFFFFFFFF` (`write_var_int32` in `slow_stream.py`) and `read_var_int32` packs the decoded value with `struct.pack('<I', v)`, which raises for the negative value produced by the Go bytes.
So a Go row with a negative `int32` field cannot be read by the Java or Python SDK. Positive values are unaffected, and Go can already read the 5 byte form because `reflect.Value.SetInt` truncates to 32 bits.
This is the INT32 counterpart of #40151 (INT16). Found while working on #39684.
### Issue Priority
Priority: 2 (default / most bugs should be filed as P2)
### Issue Components
- [ ] Component: Python SDK
- [ ] Component: Java SDK
- [x] Component: Go SDK
- [ ] Component: Typescript SDK
- [ ] Component: IO connector
- [ ] Component: Beam YAML
- [ ] Component: Beam examples
- [ ] Component: Beam playground
- [ ] Component: Beam katas
- [ ] Component: Website
- [ ] Component: Infrastructure
- [ ] Component: Spark Runner
- [ ] Component: Flink Runner
- [ ] Component: Prism Runner
- [ ] Component: Twister2 Runner
- [ ] Component: Hazelcast Jet Runner
- [ ] Component: Google Cloud Dataflow Runner
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug]: Go SDK row coder encodes negative INT32 schema fields as 10 byte varints that Java and Python reject [beam]
Posted by "Eliaaazzz (via GitHub)" <gi...@apache.org>.
Eliaaazzz commented on issue #40159:
URL: https://github.com/apache/beam/issues/40159#issuecomment-5715399157
.take-issue
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug]: Go SDK row coder encodes negative INT32 schema fields as 10 byte varints that Java and Python reject [beam]
Posted by "alisha-1000 (via GitHub)" <gi...@apache.org>.
alisha-1000 commented on issue #40159:
URL: https://github.com/apache/beam/issues/40159#issuecomment-6364543431
Hello, @Eliaaazzz !
I’ve reviewed the issue and understand the cross-SDK compatibility problem: the Go row coder currently encodes negative `INT32` values using signed 64-bit varint encoding, whereas Java and Python expect the 32-bit unsigned representation of the value.
I’d be interested in contributing to the investigation and validation of a fix, particularly by examining the existing `INT16` counterpart and identifying the appropriate regression tests to ensure consistent encoding across the Go, Java, and Python SDKs.
Would additional help with cross-SDK regression testing or related edge cases be useful for this issue?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org