sankalpsthakur opened a new pull request, #1363: URL: https://github.com/apache/arrow-go/pull/1363
### Rationale for this change Casting a struct with a nullable field to a struct type where that field is non-nullable always failed with `arrow.ErrType`, even when the field held no nulls. The C++ implementation only rejects the cast when the field actually has nulls (`scalar_cast_nested.cc`). ### What changes are included in this PR? `CastStruct` no longer rejects nullable to non-nullable fields while matching field names. It checks each selected field's null count at cast time instead, and returns `arrow.ErrInvalid` with the same message as C++ when the field has nulls. ### Are these changes tested? Yes. `TestStructToDifferentNullabilityStruct` now covers a field with no nulls (cast succeeds), fields with nulls (`ErrInvalid`), and a slice that skips the null rows (cast succeeds). - `go test ./arrow/compute/...`: ok - `go vet ./arrow/compute/...` and `gofmt -l arrow/compute`: clean ### Are there any user-facing changes? Yes. These casts now succeed when the field has no nulls. When it has nulls, the error is now `arrow.ErrInvalid` instead of `arrow.ErrType`, matching C++. Fixes #133 ### AI/LLM disclosure - AI coding tools (Claude Code) were used to write this change, the test updates and this description. - The change was reviewed and the commands above were run locally before submitting. -- 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]
