zeroshade commented on PR #1194: URL: https://github.com/apache/iceberg-go/pull/1194#issuecomment-4693248886
Thanks for digging into this, @strophy 🙏 I pushed an alternative fix to this branch (force-pushed over your commit — the previous version is still reachable via the PR's force-push timeline). It resolves the same s390x failure but keeps the generics intact. **Root cause** (confirmed with a local repro + upstream [golang/go#76744](https://github.com/golang/go/issues/76744)): the crash isn't in the comparator logic — it's the generic instantiation boxing a scalar *zero value* into an interface (`var z T; NewLiteral(z)` with `T = bool`). Boxing a 1-byte value makes the compiler reference `runtime.staticuint64s`, and on big-endian the resulting relocation isn't aligned the way the s390x linker requires. **Fix:** perform `NewLiteral`'s type switch on `&val` (a pointer) instead of `val`. Pointer values take the compiler's `IsDirectIface` path and skip the `staticuint64s` optimization entirely, so the bad relocation is never emitted. Because the boxing was the only problem, everything else stays as-is: - `getComparator` and `newStatAgg` keep their original generic bodies — no new exported API, no per-call-site comparators. - Only `NewLiteral` in `literals.go` changes; `manifest.go`, `parquet_files.go`, and `table/internal/utils.go` are untouched. - Behavior and allocation counts are unchanged (benchmarked bool/int64/string — identical allocs). **Verification:** the failure reproduces on any machine with `GOOS=linux GOARCH=s390x go build ./...` (it's a link-time error, so it has to link a main package) — no s390x hardware required. Confirmed fixed, and the full test suite passes. I also added a `cross-compile` CI job that links for **s390x** so this can't silently regress. Worth noting: s390x specifically is what catches it — I tested ppc64 (also big-endian) and its linker does *not* reject the relocation, so a ppc64 check would stay green even with the bug present. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
