-
Notifications
You must be signed in to change notification settings - Fork 97
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(c,format,python): implement error details #954
Conversation
@zeroshade @kou @ywc88 this is the alternative to #946 using Kou's idea. It's very clearly unfinished, but it's much more straightforward to implement IMO. If this seems roughly reasonable, and we prefer this to the other PR, I'll add all the tests/compatibility tests, finish up the implementation here, fix up the generated Go code, and copy over the bits of the other PR that are still useful. |
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.
+1
c/driver/common/utils.c
Outdated
struct AdbcErrorDetails* details = (struct AdbcErrorDetails*)error->private_data; | ||
free(details->message); | ||
|
||
for (int i = 0; i < 2 * details->count; i++) { |
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 seems that we can use details->count
instead of 2 * details->count
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.
ah, good catch - at one point I had encoded both the keys and values in the same array
8c19b37
to
c6f3be3
Compare
Hmm, the main weakness I see here is there's no way for us to augment an ArrowArrayStream with error details. We could add something like this? struct AdbcError* AdbcErrorFromArrayStream(struct ArrowArrayStream* stream); that only works for an ArrowArrayStream produced by an ADBC driver. Thoughts? (For this, the driver manager would have to wrap the ArrowArrayStream itself, but that's probably OK.) |
a93bce5
to
a291dcd
Compare
Minus the question above, I believe this is ready. If we think this is good, I'll merge this, then follow up and delete the error_details stuff/fix up and make the Go driver work, and also pull any improvements that are still applicable from the old PR. |
When do we need this? When the last |
@kou yes, that's the case I'm thinking about. (For instance, for Flight SQL, if we get an error in the middle of the stream.) So in that case, It would be annoying to implement, but that's OK. The driver manager would wrap all ArrowArrayStream results with its own implementation, and return to the client its own implementation. The wrapper stream will store the original stream and |
Thanks but I'm not sure when/how to use |
struct ArrowArrayStream stream = ...;
while (true) {
struct ArrowArray batch;
if (int code = stream.get_next(&stream, &batch); code != 0) {
struct AdbcError* error = AdbcErrorFromArrayStream(&stream);
if (error != nullptr) {
std::cout << error->message << " SQLSTATE: " << error->sqlstate << std::endl;
// Also use AdbcErrorGetDetailCount, etc.
} else {
std::cout << stream.get_last_error(&stream) << std::endl;
}
} else if (batch.release == nullptr) {
break;
}
// Process batch
} |
a291dcd
to
3b75f23
Compare
3b75f23
to
9ab6d26
Compare
Since it looks like pitrou/zeroshade are unavailable and I don't want to be blocked, I'm going to merge this for now. If AdbcErrorFromArrayStream seems reasonable, I'll demo it in a follow-up PR. |
Thanks. |
Thanks for the help! I'll follow up with another PR and I hope that'll be the last in the ADBC 1.1.0 drafts... |
No description provided.