Skip to content

Conversation

@imilinovic
Copy link
Contributor

Description

Implemented collections.sumLongs and added test for it.

Pull request type

  • Bugfix
  • Algorithm/Module
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

######################################

Reviewer checklist (the reviewer checks this part)

Module/Algorithm

######################################

@imilinovic imilinovic self-assigned this Jul 19, 2023
@imilinovic imilinovic changed the title implemented sumLongs and added tests for it [E-ivan-add-collections < T413-MAGE-implement-sumLongs] Add collections.sumLongs Jul 19, 2023
@imilinovic imilinovic changed the title [E-ivan-add-collections < T413-MAGE-implement-sumLongs] Add collections.sumLongs [E-ivan-add-collections < T413-MAGE-implement-sumLongs] Add collections.sumlongs Jul 19, 2023
const auto record_factory = mgp::RecordFactory(result);

try {
int64_t sum = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
int64_t sum = 0;
int64_t sum{0};

const auto &list = arguments[0].ValueList();

for (const auto list_item : list){
if(!list_item.IsNumeric())
Copy link
Contributor

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

Copy link
Contributor

@antoniofilipovic antoniofilipovic left a 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
Copy link
Contributor

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";
Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor

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 antoniofilipovic added the status: change PR reviewed - needs changes label Jul 19, 2023
@imilinovic imilinovic removed the status: change PR reviewed - needs changes label Jul 21, 2023
@imilinovic imilinovic changed the title [E-ivan-add-collections < T413-MAGE-implement-sumLongs] Add collections.sumlongs [E-ivan-add-collections < T413-MAGE] Add collections.sumlongs Jul 24, 2023
@imilinovic imilinovic changed the title [E-ivan-add-collections < T413-MAGE] Add collections.sumlongs [E-ivan < T413] Implement collections.sumlongs Jul 24, 2023
@imilinovic imilinovic changed the title [E-ivan < T413] Implement collections.sumlongs [E-ivan < T413] Implement collections.sumLongs Jul 24, 2023
@imilinovic imilinovic added the status: ready PR is ready for review label Jul 24, 2023
Copy link
Contributor

@antoniofilipovic antoniofilipovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to go

@antoniofilipovic antoniofilipovic added status: ship it PR approved and removed status: ready PR is ready for review labels Jul 25, 2023
@imilinovic imilinovic merged commit 36dc58f into E-ivan-add-collections Jul 27, 2023
@imilinovic imilinovic deleted the T413-MAGE-implement-sumlongs branch July 27, 2023 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: ship it PR approved

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants