ShivamSharma43 opened a new pull request, #1705:
URL: https://github.com/apache/arrow-go/pull/1705

   ### Rationale for this change
   
   Casting a `float16` array to `utf8`, `large_utf8` or `string_view` fails:
   
   ```
   not implemented: function 'cast_string' has no kernel matching input types 
(float16)
   ```
   
   `string_casts.go` already has `float16Formatter`, a `FLOAT16` case in 
`getNumericToStringCastExec` and a `FLOAT16` bound in `maxFormattedBytes`, but 
`addNumericAndTemporalToStringCasts` only registers kernels for the types in 
`numericTypes`, and that list doesn't include `float16`. So the kernel is never 
registered.
   
   ### What changes are included in this PR?
   
   `addNumericAndTemporalToStringCasts` registers the existing numeric 
to-string kernel for `float16` too, alongside the other numeric types. 
`numericTypes` itself is unchanged, since many other kernels use it.
   
   Related: #1704 changes how these same kernels allocate and release their 
output. The two changes don't depend on each other and merge cleanly. Because 
`float16` goes through the same registration loop, it picks up the #1704 fix 
too once both are in.
   
   ### Are these changes tested?
   
   Yes. `TestFloat16ToString` casts `0`, `-0`, `1.5`, `-2.25`, `65504`, `-Inf`, 
`+Inf`, `NaN` and a null to `utf8`, `large_utf8` and `string_view`, as arrays 
and as scalars. `TestCanCast` now checks that `float16` can be cast to all 
three. Without the fix the new test fails with the error above.
   
   The new test doesn't check for leaks with a checked allocator in the 
context. On main these kernels still leak their output buffers for every input 
type, which #1704 fixes.
   
   On Windows amd64 with Go 1.26.11, `go test -tags assert,test 
./arrow/compute/ -run Cast` and `go test -tags assert,test 
./arrow/compute/internal/kernels/` pass, `go vet` is clean for both packages, 
and `golangci-lint` reports no new issues.
   
   ### Are there any user-facing changes?
   
   No API changes. `float16` values can now be cast to string types.
   
   This PR was prepared with AI assistance (Claude Code).
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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]

Reply via email to