-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ARROW-9761: [C/C++] Add experimental C stream inferface #8052
Changes from all commits
45b5dff
f25feb2
b79e88f
565889e
645406f
3badb80
87e8f73
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,6 +60,44 @@ struct ArrowArray { | |
void* private_data; | ||
}; | ||
|
||
// EXPERIMENTAL: C stream interface | ||
|
||
struct ArrowArrayStream { | ||
// Callback to get the stream type | ||
// (will be the same for all arrays in the stream). | ||
// | ||
// Return value: 0 if successful, an `errno`-compatible error code otherwise. | ||
// | ||
// If successful, the ArrowSchema must be released independently from the stream. | ||
int (*get_schema)(struct ArrowArrayStream*, struct ArrowSchema* out); | ||
|
||
// Callback to get the next array | ||
// (if no error and the array is released, the stream has ended) | ||
// | ||
// Return value: 0 if successful, an `errno`-compatible error code otherwise. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. silly question is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know how to phrase it: it returns value that are |
||
// | ||
// If successful, the ArrowArray must be released independently from the stream. | ||
int (*get_next)(struct ArrowArrayStream*, struct ArrowArray* out); | ||
|
||
// Callback to get optional detailed error information. | ||
// This must only be called if the last stream operation failed | ||
// with a non-0 return code. | ||
// | ||
// Return value: pointer to a null-terminated character array describing | ||
// the last error, or NULL if no description is available. | ||
// | ||
// The returned pointer is only valid until the next operation on this stream | ||
// (including release). | ||
const char* (*get_last_error)(struct ArrowArrayStream*); | ||
|
||
// Release callback: release the stream's own resources. | ||
// Note that arrays returned by `get_next` must be individually released. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are arrays produced by this stream tied to the lifecycle of this stream (must they be released first?) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm... I'd say no. |
||
void (*release)(struct ArrowArrayStream*); | ||
|
||
// Opaque producer-specific data | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit ntew line here or remove the new line above? |
||
void* private_data; | ||
}; | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
released
is something defined in the ArrowArray-spec. Is it stronger or weaker guarantee then returning a nullptr here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A nullptr cannot be returned. The callback returns an
int
. However, we could say that returning-1
means end of stream.