apache / arrow-nanoarrow

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

[C] Add convenience functions #70

Closed paleolimbot closed 1 year ago

paleolimbot commented 1 year ago

...based on writing some nanoarrow code in the R package, https://github.com/geoarrow/geoarrow-cpp/ , and https://github.com/paleolimbot/minigpkg/

A few that may be nice are:

Another thing that came up is a pattern for unsafe appends. The buffer appenders in the ArrowBufferAppendInt32() family all check and possibly reallocate; the array appenders in the ArrowArrayAppendInt() family do a switch() on type and range checks to help prevent implicit overflow. Adding more convenience around this like maybe ArrowBufferAppendInt32Unsafe() or ArrowArrayInt32AppendInt32Unsafe() is probably very verbose and isn't that hard to work around. I could be convinced either way on whether they should exist or not.

lidavidm commented 1 year ago

At the risk of turning into a general C utilities library, I've found having a string builder utility also useful in the ADBC SQLite driver I'm working on.

paleolimbot commented 1 year ago

I forget exactly where I did that but I definitely did it too at least once (I think I was building error messages).

paleolimbot commented 1 year ago

Oh! It's was in nanoarrow itself but I changed approaches...it was the first draft of the ArrowSchemaToString().