-
Notifications
You must be signed in to change notification settings - Fork 35
[E-ivan < T413] Implement collections.sumLongs #239
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
[E-ivan < T413] Implement collections.sumLongs #239
Conversation
| const auto record_factory = mgp::RecordFactory(result); | ||
|
|
||
| try { | ||
| int64_t sum = 0; |
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.
| int64_t sum = 0; | |
| int64_t sum{0}; |
| const auto &list = arguments[0].ValueList(); | ||
|
|
||
| for (const auto list_item : list){ | ||
| if(!list_item.IsNumeric()) |
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.
Same comment as on other PR to use {} for if statement
antoniofilipovic
left a comment
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.
Few comments, looks good!
| record_factory.SetErrorMessage(e.what()); | ||
| return; | ||
| } | ||
| } No newline at end of file |
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 empty lines here too
|
|
||
| namespace Collections{ | ||
|
|
||
| constexpr const char *kResultSumLongs = "sum"; |
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.
const char * is a global that may change. use constexpr std::string_view for better code stlye
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.
In this exact place kResultSumLongs needs to be char* because field_name in record.Insert() needs to be char*, changed in other places.
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.
You can use on that std::string(kResultSumLongs).c_str()
antoniofilipovic
left a comment
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 to go
Description
Implemented collections.sumLongs and added test for it.
Pull request type
######################################
Reviewer checklist (the reviewer checks this part)
Module/Algorithm
######################################