paleolimbot opened a new issue, #8:
URL: https://github.com/apache/arrow-nanoarrow/issues/8
This will require a bit of code but is also the thing that most people need
help with when generating C arrays (looping over some row-based structure and
generating a column-based structure). One way to do this is a bunch of
callables that are something like the reverse of SQLite's result interface:
```c
struct ArrowArrayBuilder {
ArrowErrorCode (*append_null)(struct ArrowArraybuilder*);
ArrowErrorCode (*append_int64)(struct ArrowArrayBuilder*, int64_t value);
ArrowErrorCode (*append_double)(struct ArrowArrayBuilder*, double value);
ArrowErrorCode (*append_string)(struct ArrowArrayBuilder*, struct
ArrowStringView* value);
ArrowErrorCode (*append_blob)(struct ArrowArrayBuilder*, struct
ArrowBufferView* value);
ArrowErrorCode (*append_array)(struct ArrowBufferView*, struct
ArrowArray*, struct ArrowSchema*);
ArrowErrorCode (*borrow_schema)(struct ArrowBufferView*, struct
ArrowSchema** schema_out);
ArrowErrorCode (*build_array)(struct ArrowBufferView*, struct ArrowArray*
array_out, struct ArrowSchema* schema_out);
void (*release)(struct ArrowArrayBuilder*);
void* private_data;
};
```
Unike SQLite, I think this should error instead of coerce (i.e.,
`append_string()` on an integer builder errors and doesn't try to parse the
string).
We could/should provide implementations for some array types, which I think
only has to be one function. This
```c
ArrowErrorCode ArrowBuilderInit(struct ArrowBufferView* builder, struct
ArrowSchema* schema);
```
Errors could be added as a `struct ArrowError*` arg to each method or as a
`struct ArrowError` member to the `ArrowArrayBuilder`.
--
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]