-
Notifications
You must be signed in to change notification settings - Fork 46
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
[Improvement][C++] Refine the error message of errors of C++ SDK #192
Conversation
🎊 PR Preview eeca88e has been successfully built and deployed to https://alibaba-graphar-build-pr-192.surge.sh 🤖 By surge-preview |
@lixueclaire The error messages maybe not very correct for writer and builder , or collections(just base on my understanding), can you take a look to the fulfill and if it's not correct, any improvement is good, thanks a lot. |
Sure, I'll have a look soon. Thank you for making this change. |
@@ -69,9 +91,6 @@ enum class StatusCode : unsigned char { | |||
kKeyError, | |||
kTypeError, | |||
kInvalid, | |||
kInvalidValue, |
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.
Could you please add some comments for the enum class to briefly introduce the types of different status code?
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.
@@ -851,8 +881,8 @@ class EdgeInfo { | |||
const PropertyGroup& property_group, AdjListType adj_list_type, | |||
IdType vertex_chunk_index, IdType edge_chunk_index) const { | |||
if (!ContainPropertyGroup(property_group, adj_list_type)) { | |||
return Status::KeyError( | |||
"The edge info does not contain the property group."); | |||
return Status::KeyError("The property group: ", property_group, |
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.
Add "." in the end. The same for the following changes.
@@ -84,7 +84,9 @@ class VertexPropertyArrowChunkReader { | |||
chunk_table_.reset(); | |||
} | |||
if (chunk_index_ >= chunk_num_) { | |||
return Status::KeyError(); |
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.
For me, it is a little confused to decide when to use KeyError
, and when to use Invalid
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 think, KeyError
should use in the scenario that user give a key, we can't find a key in our structure like that, otherwise, use a Invalid
, so here raise Invalid
is better. Thanks for question, I will fix it
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 think,
KeyError
should use in the scenario that user give a key, we can't find a key in our structure like that, otherwise, use aInvalid
, so here raiseInvalid
is better. Thanks for question, I will fix it
Then, it is not very clear that which can be called as a "Key": internal vertex id? chunk index? property name? property group? vertex/edge label? adj_list type? ....
@@ -348,7 +359,10 @@ class AdjListOffsetArrowChunkReader { | |||
chunk_table_.reset(); | |||
} | |||
if (chunk_index_ >= vertex_chunk_num_) { | |||
return Status::KeyError(); | |||
return Status::KeyError("Internal vertex id ", id, |
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 am not sure that why not to use OutofRange
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.
good point, as above mention, I think I confused the KeyError and OutOfRange here, in the seek
scenario, the given parameter is in a range and it should raise a OutOfRange here. I will double check all the seek
operation.
cpp/src/graph_info.cc
Outdated
@@ -108,7 +108,7 @@ Status VertexInfo::Save(const std::string& path) const { | |||
|
|||
Result<EdgeInfo> EdgeInfo::Load(std::shared_ptr<Yaml> yaml) { | |||
if (yaml == nullptr) { | |||
return Status::YamlError("yaml is nullptr"); | |||
return Status::Invalid("yaml is nullptr"); |
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.
modify the message to "yaml shared pointer is nullptr" to be consistent
cpp/src/arrow_chunk_writer.cc
Outdated
field = schema->field(index); | ||
if (field->type()->id() != arrow::Type::INT64) { | ||
return Status::TypeError( | ||
"the data type for destination column should be INT64, but got " + | ||
"The data type for destination column should be INT64, but got ", |
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.
add "index" before "column" to be consistent
cpp/src/arrow_chunk_writer.cc
Outdated
return Status::InvalidOperation("the offset column is not provided"); | ||
if (index == -1) { | ||
return Status::Invalid("The offset column ", GeneralParams::kOffsetCol, | ||
" is not exist in the input table"); |
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.
does not exist
cpp/src/arrow_chunk_writer.cc
Outdated
if (index == -1) { | ||
return Status::Invalid("The source index column ", | ||
GeneralParams::kSrcIndexCol, | ||
" is not exist in the input table"); |
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.
ditto
cpp/src/arrow_chunk_writer.cc
Outdated
if (index == -1) { | ||
return Status::Invalid("The destination index column ", | ||
GeneralParams::kDstIndexCol, | ||
" is not exist in the input table"); |
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.
ditto
cpp/src/arrow_chunk_writer.cc
Outdated
return Status::Invalid("Property ", property.name, " of property group ", | ||
property_group, " of edge ", | ||
edge_info_.GetEdgeLabel(), | ||
" is not exist in the input table."); |
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.
ditto
Signed-off-by: acezen <qiaozi.zwb@alibaba-inc.com>
6d9e435
to
29cef4f
Compare
cpp/src/arrow_chunk_writer.cc
Outdated
if (index == -1) { | ||
return Status::Invalid("The source index column ", | ||
GeneralParams::kSrcIndexCol, | ||
" is not exist in the input table"); |
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.
does not
cpp/src/arrow_chunk_writer.cc
Outdated
if (index == -1) { | ||
return Status::Invalid("The destination index column ", | ||
GeneralParams::kDstIndexCol, | ||
" is not exist in the input table"); |
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.
does not
cpp/src/arrow_chunk_writer.cc
Outdated
" vertex info."); | ||
} | ||
if (chunk_index < 0) { | ||
return Status::Invalid("The chunk index is negative."); |
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 think IndexError is more suitable 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.
And the unit test need to be updated too.
Proposed changes
This change aims to refine the error constructor and fulfill the error message detail for C++ SDK.
Types of changes
What types of changes does your code introduce to GraphAr?
Put an
x
in the boxes that applyChecklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.Further comments
Related issue: #140