-
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
[EXP] ARROW-4036: [C++] Pluggable status codes #3199
Conversation
This approach uses static registration.
@@ -77,4 +80,39 @@ TEST(StatusTest, AndStatus) { | |||
ASSERT_TRUE(res.IsInvalid()); | |||
} | |||
|
|||
static const char* test_messages1[] = {"First error", "Second 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.
See example use here.
std::string msg; | ||
}; | ||
// OK status has a `NULL` state_. Otherwise, `state_` points to | ||
// a `State` structure containing the error code and message(s) | ||
State* state_; | ||
|
||
static std::unordered_map<uint64_t, const StatusRange*> ranges_; |
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.
Seems like we're needing more and more a global arrow::init()
.
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.
Are you afraid of the static initialization 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.
Yes, seems likely that we'll need more and more controlled static initialization:
- Utf8 utils make use of call_once
- This patch (which other static initializers might depend in proper order, but controllable since we're referencing with int32/int64)
- Gandiva make use of call_once, I think this one can be tricky due to possible failures and the time it takes to init, e.g. it's friendlier to the user if he has visibility (time take, failure, ...)
@pitrou @fsaintjacques what is the status of this? |
@emkornfield It's completely stale, and noone is actively working on it. I still think it's a good idea, though, because we have more and more subsystems (Python, R, Flight, etc.). One useful extension of this would be to have optional arbitrary data embedded in the error state, for example if an error comes from a Python exception, it would be useful to record the original Python exception - especially if the Status is converted back into a Python error, so that the traceback doesn't get lost. |
@pitrou @emkornfield I agree that it's a good idea, as long as it doesn't cause any performance issues. I see this introduces unordered_map into the includes which may want to be avoided based on recent patches =) |
@wesm @pitrou I agree it could be useful I guess I was asking what the blockers are? Should we close this PR and formulate a new one? @pitrou you mentioned prioritization on an ML thread, if you would like me to take this on, I can put it on my backlog (no performance regression might be challenging). Is there a clear list of requirements. |
@emkornfield There are no blockers per se. There are several constraints:
So this is a study in C++ API design. |
Is full pluggabiity necessary? I think it would be good to keep the types of errors limited. Would a status that has the following traits suffice?
|
If you have something precise in mind, perhaps best is to try and sketch an implementation, and post another PR? |
No, this can be closed. |
This approach uses static registration. I recommend comparing with other approaches.