paleolimbot commented on issue #811:
URL: https://github.com/apache/arrow-adbc/issues/811#issuecomment-2123679404
A minor modification of Matt's proposal for the sake of argument:
```c
struct ArrowArrayStreamHandler {
// For parity with the device array stream?
int32_t device_type;
// return codes would be errno, but no need to pass a message since it
would just be
// passed to the handler anyway via on_error. If an error code is
returned here the
// producer must pass it to on_error()
int (*on_schema)(struct AsyncArrowStream* self, struct ArrowSchema* out);
// Always called at least once with a released array to indicate the end
except if on_error
// is called, in which case it would be the last call.
int (*on_next)(struct AsyncArrowStream* self, struct ArrowDeviceArray*
out);
// For R I'd need this so that I can call some promise$reject() method,
and I think it's needed
// Metadata here would be identical to ArrowSchema::metadata but the
handler method would need
// would need to copy it (and message) if it needs to live after the
handler function returns.
void (*on_error(struct AsyncArrowStream* self, int code, const char*
message, const char* metadata);
void (*release)(struct AsyncArrowStream* self);
void* private_data;
};
```
...which has a few features:
- Could theoretically be part of the Arrow C Stream for ABI stability (e.g.,
I could make an interface for an IPC writer from this and wire it up directly
to an ADBC call from another Python package, or make )
- One place to handle errors (either from producer or consumer)
...and drawbacks:
- No ADBC-specific things like errors or `rows_affected`
- Probably many things I haven't considered 🙂
--
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]