-
Notifications
You must be signed in to change notification settings - Fork 99
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
feat(format): introduce ADBC API revision 1.1.0 #692
Conversation
b860a60
to
e97c30f
Compare
I've addressed feedback + added APIs for most of the new proposals. If this is OK I'll follow up with Go (with a set of interfaces, one per method or so) and Java (which is very easy). I think we will have to punt on #320 and #621. I don't think #630 is worth doing. #685 is too speculative at this point. |
adbc.h
Outdated
AdbcStatusCode AdbcStatementCancel(struct AdbcStatement* statement, | ||
struct AdbcError* error); | ||
|
||
/// \brief Get a double property of the statement. |
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.
what would this be used for? is it just to avoid consumers having to call strtof
/strtod
themselves?
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.
There's a constant above motivating it. Also, 1) there's no Get* function at all right now and 2) returning strings is really annoying due to allocations.
I could change this to return a string, the caveats would be either: 1) we have to add some release-callback thing (C Data Interface-ish) or 2) we return a const char*, but calling this again or doing other things with the statement will invalidate the pointer (SQLite-ish) or 3) we expect a caller-allocated and/or fixed-size buffer (ODBC-ish)
if (version >= ADBC_VERSION_1_1_0) { | ||
auto* driver = reinterpret_cast<struct AdbcDriver*>(raw_driver); | ||
FILL_DEFAULT(driver, StatementExecuteSchema); |
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.
shouldn't this also have the same for the other new functions? AdbcStatementCancel
and AdbcStatementGetDouble
?
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.
I'm going to defer implementation, just wanted to demonstrate the basic idea worked. I just want to get the API sort of in the right shape.
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.
Agh, let me retarget this PR against the branch, not main.
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.
There - the intent is to build this out on a branch then manually ff-merge it at the end. If the approach looks reasonable I'm also going to build out more serious compatibility tests.
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.
Gotcha, okay then in that case I'm in favor of this approach.
Interestingly the CI failure exposes what does look like a compatibility issue: the new fields in AdbcDriver make the Python test crash (because it mixes a driver using the new definition and a wheel using the old definition) |
Ah, because the drivers do this
and now that the struct has changed, they need to actually check the size of the struct they're about to manipulate. |
e97c30f
to
bd5d608
Compare
I'm quite tempted to just remove cpplint, it seems to mostly just give noise and it's basically unconfigurable/unmaintained |
bd5d608
to
f89fb97
Compare
Some other thoughts: maybe we shouldn't overload getInfo for things like current catalog/schema, and instead add a get/set option pair? That would be consistent with how Java does this |
f89fb97
to
9ee2b8d
Compare
Added Java and Go, though I think I'd like to go back and align things a bit. |
5d4f31d
to
7761b84
Compare
There's a macOS error in CI that I'll try to track down, but otherwise I think this is ready (for C, Java, Go) |
TODOs
|
7761b84
to
6cae1a4
Compare
I never really learned amd64 assembly but I think the CI failure I'm seeing is possibly a miscompilation or something odd? I see basically an unconditional call to UBSAN's abort here:
aka (if I'm reading it right):
Ghidra seems to agree: if (param_1 == 1000000) {
if (param_2 == 0) {
local_9 = 5;
}
else {
___ubsan_handle_type_mismatch_v1_abort(&DAT_00194780,0); I'm not sure why this is happening, or if there's UB in the code and this is a consequence of it... In the debugger, I can confirm |
6cae1a4
to
c296e17
Compare
For now let's see if writing it differently helps... |
Ah, I think I know what happened. |
c296e17
to
0a3ba63
Compare
Fixes apache#317. Co-authored-by: Matt Topol <[email protected]>
if (!statement->private_driver) { | ||
return ADBC_STATUS_INVALID_STATE; | ||
} | ||
return statement->private_driver->StatementExecuteSchema(statement, schema, error); |
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.
Should the pointer-to-function be checked for null? Or is it the caller's job?
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.
It's assumed that if you're using these functions, you're using the driver manager, and that the driver manager has initialized all the functions. (Obviously, not true right now, since I decided to split implementation out.)
I'm going to merge this soon (into the branch) and then update/continue the follow-up PRs. |
Ah...let me file a follow up PR for some of Antoine's last comments |
Fixes apache#317. --------- Co-authored-by: Matt Topol <[email protected]> Co-authored-by: Sutou Kouhei <[email protected]>
Fixes #317. --------- Co-authored-by: Matt Topol <[email protected]> Co-authored-by: Sutou Kouhei <[email protected]>
Fixes #317. --------- Co-authored-by: Matt Topol <[email protected]> Co-authored-by: Sutou Kouhei <[email protected]>
Fixes #317. --------- Co-authored-by: Matt Topol <[email protected]> Co-authored-by: Sutou Kouhei <[email protected]>
Fixes #317. --------- Co-authored-by: Matt Topol <[email protected]> Co-authored-by: Sutou Kouhei <[email protected]>
Fixes #317. --------- Co-authored-by: Matt Topol <[email protected]> Co-authored-by: Sutou Kouhei <[email protected]>
Fixes #317. --------- Co-authored-by: Matt Topol <[email protected]> Co-authored-by: Sutou Kouhei <[email protected]>
Fixes #317. --------- Co-authored-by: Matt Topol <[email protected]> Co-authored-by: Sutou Kouhei <[email protected]>
Fixes #317. --------- Co-authored-by: Matt Topol <[email protected]> Co-authored-by: Sutou Kouhei <[email protected]>
Fixes #317. --------- Co-authored-by: Matt Topol <[email protected]> Co-authored-by: Sutou Kouhei <[email protected]>
Fixes #317.