-
Notifications
You must be signed in to change notification settings - Fork 100
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
c: add 'helpers' header for C++ users #598
Comments
One step further might be to provide an object-oriented wrapper around the C APIs, e.g. namespace adbc {
class Connection {
public:
StatusOr<Statement> NewStatement();
};
} |
Oh, and potentially helpers to work with AdbcStatusCode as arrow::Status or similar... |
For nanoarrow the C++ helpers header has been absolutely essential...without it it's very easy to leak memory when mixed with other C++ idioms (mostly just this part https://github.com/apache/arrow-nanoarrow/blob/main/src/nanoarrow/nanoarrow.hpp#L107-L147 ). That implementation was basically trying to replicate the syntax + move-only semantics of I should almost certainly provide a return value helper, too, because the nanoarrow user code that I've read so far does a lot of ignoring of return values. |
Yeah, if we had |
By the time C++23 is an acceptable constraint we'll all be using Rust anyway 🙂 |
Yeah, we're slowly inching to an |
I'd like to pick this up soon since it would be very helpful for driver authors to do low level tests on their implementations like: arrow-adbc/c/driver/common/driver_test.cc Line 68 in 8ea1ce1
One could also go even further and make something that is ergonomically C++-y, but my immediate use case is something portable that doesn't involve a driver author managing C memory. This is vaguely how writing nanoarrow C++ works: there are still some C function calls, but no C memory management.
One could either have some "Session" that has a trash can for unreleasable objects (and/or a mechanism for a notice/warning that this has happened), or just stderr and leaking the object (which is probably sufficient for testing). |
Mostly this should contain RAII utilities like those in the PostgreSQL driver. It would make life much easier for C++ users. (There is a question of what to do with errors in Release(); we could make it configurable to throw/ignore/abort perhaps.) We could distribute it as a header alongside the driver manager that can also be copy-pasted.
The text was updated successfully, but these errors were encountered: