-
Notifications
You must be signed in to change notification settings - Fork 35
[E-ivan < T410] Implement collections.avg #235
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
Conversation
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.
Looks good, few comments about style.
| constexpr const char *kProcedureAvg = "avg"; | ||
|
|
||
| constexpr const char *kReturnAvg = "average"; | ||
|
|
||
| constexpr const char *kNumbersList = "list_of_numbers"; |
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.
use on these constexpr std::string_view asconst char *is a global that may change.
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 would move these globals to hpp if possible, otherwise keep all either in cpp or hpp.
|
|
||
| void Avg(mgp_list *args, mgp_graph *memgraph_graph, mgp_result *result, mgp_memory *memory); | ||
|
|
||
| } 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.
This red circle on GitHub means that you are missing an empty line at the end of the file. Practice is on our side to always have an empty line after the last line in the file.
| CALL collections.avg([-5, 5, 2.2, -8.6, 0, 1.0]) | ||
| YIELD average; | ||
| output: | ||
| - average: -0.8999999999999999 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.
The empty line is missing here too and on some other files. Add empty line please on other files to
| 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.
add {} for this if. It is style generally in MAGE
| const auto record_factory = mgp::RecordFactory(result); | ||
|
|
||
| try { | ||
| double average = 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.
| double average = 0; | |
| double average{0}; |
|
@imilinovic sorry your PR is still in draft but I left couple of comments for later :D |
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.avg query module procedure and added tests for it.
Pull request type
######################################
Reviewer checklist (the reviewer checks this part)
Module/Algorithm
######################################