apache / arrow-nanoarrow

Helpers for Arrow C Data & Arrow C Stream interfaces
https://arrow.apache.org/nanoarrow
Apache License 2.0
169 stars 35 forks source link

feat: add support for appending values to half float `ArrowArray` #499

Closed cocoa-xu closed 4 months ago

cocoa-xu commented 4 months ago

Hi, thanks for this great library! I found that ArrowArrayAppendXX functions won't append a value to a half float ArrowArray while I was playing with this library. So I decided to add this support, which I believe it should make this library easier to use.

The conversion function is adapted from Arrow Go, https://github.com/apache/arrow/blob/main/go/arrow/float16/float16.go, and the tests cases are taken from https://github.com/apache/arrow/blob/main/go/arrow/float16/float16_test.go.

Although I'm not sure if I should also update the files in dist though (I guess it might be automated when doing a release but I didn't check). I'll be happy to update them if these files are not updated automatically, and I'm happy to do any other changes. :)

cocoa-xu commented 4 months ago

@paleolimbot @benibus Many thanks for the code review!

cocoa-xu commented 4 months ago

Hi, I've formatted the code and fixed the tests. Just let me know if we should add any generated test cases for these one-way conversions, and I'll happy to add a few cases!

cocoa-xu commented 4 months ago

Sorry for the delay, I wanted to make sure I had time to check this out and run some tests locally.

Thank you very much for the kind help and code review!