Skip to content
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

Refactor setOutputVar() to enforce the assignment of colNames explicitly. #4920

Closed
wants to merge 1 commit into from

Conversation

xtcyclist
Copy link
Contributor

@xtcyclist xtcyclist commented Nov 23, 2022

What type of PR is this?

  • bug
  • feature
  • enhancement

What problem(s) does this PR solve?

Issue(s) number:

Close #4919
Close #4881

Description:

There is a risk that colNames are borrowed from a outputVar by mistake.

How do you solve it?

Change the method's input parameters to require colNames explicitly.

Changing

  lhs->setOutputVar("var5");
  lhs->setColNames({"v2", "e2", "v3"});

to

lhs->setOutputVar("var5", {"v2", "e2", "v3"});

Special notes for your reviewer, ex. impact of this fix, design document, etc:

Checklist:

Tests:

  • Unit test(positive and negative cases)
  • Function test
  • Performance test
  • N/A

Affects:

  • Documentation affected (Please add the label if documentation needs to be modified.)
  • Incompatibility (If it breaks the compatibility, please describe it and add the label.)
  • If it's needed to cherry-pick (If cherry-pick to some branches is required, please label the destination version(s).)
  • Performance impacted: Consumes more CPU/Memory

Release notes:

Please confirm whether to be reflected in release notes and how to describe:

ex. Fixed the bug .....

@xtcyclist xtcyclist added the ready-for-testing PR: ready for the CI test label Nov 23, 2022
@xtcyclist xtcyclist changed the title Refactor all the setting of outputVar() to enforce the assignment of … Refactor all the setting of setOutputVar() to enforce the assignment of … Nov 23, 2022
@xtcyclist xtcyclist changed the title Refactor all the setting of setOutputVar() to enforce the assignment of … Refactor setOutputVar() to enforce the assignment of colNames explicitly. Nov 23, 2022
@Shylock-Hg
Copy link
Contributor

Emmm. The column names of plan node are bind to output variable. This PR will fix some errors but lead to the others, in my mind.

@xtcyclist
Copy link
Contributor Author

Emmm. The column names of plan node are bind to output variable. This PR will fix some errors but lead to the others, in my mind.

What other errors?

@Shylock-Hg
Copy link
Contributor

Emmm. The column names of plan node are bind to output variable. This PR will fix some errors but lead to the others, in my mind.

What other errors?

Emm, not sure.

@codecov-commenter
Copy link

Codecov Report

Base: 76.86% // Head: 76.90% // Increases project coverage by +0.04% 🎉

Coverage data is based on head (f86422a) compared to base (8adec8d).
Patch coverage: 87.83% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4920      +/-   ##
==========================================
+ Coverage   76.86%   76.90%   +0.04%     
==========================================
  Files        1105     1105              
  Lines       81432    81444      +12     
==========================================
+ Hits        62594    62638      +44     
+ Misses      18838    18806      -32     
Impacted Files Coverage Δ
...c/graph/optimizer/rule/EliminateRowCollectRule.cpp 20.68% <0.00%> (ø)
.../rule/PushLimitDownScanEdgesAppendVerticesRule.cpp 48.21% <0.00%> (ø)
...raph/optimizer/rule/PushLimitDownScanEdgesRule.cpp 47.05% <0.00%> (ø)
src/graph/planner/plan/PlanNode.h 89.42% <ø> (ø)
src/meta/processors/parts/ListHostsProcessor.cpp 69.52% <0.00%> (-2.77%) ⬇️
...graph/optimizer/rule/PushFilterDownGetNbrsRule.cpp 75.47% <50.00%> (ø)
...aph/optimizer/rule/PushFilterDownInnerJoinRule.cpp 85.71% <50.00%> (ø)
.../optimizer/rule/PushFilterDownScanVerticesRule.cpp 72.91% <50.00%> (ø)
src/graph/planner/plan/PlanNode.cpp 86.32% <75.00%> (-0.41%) ⬇️
src/clients/meta/MetaClient.cpp 76.58% <100.00%> (+0.06%) ⬆️
... and 84 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@@ -221,7 +221,7 @@ class PlanNode {
return numDeps() == 2U;
}

void setOutputVar(const std::string& var);
void setOutputVar(const std::string& var, const std::vector<std::string>& colNames);
Copy link
Contributor

Choose a reason for hiding this comment

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

better to give the colNames parameter a default value, such as empty vector, so you don't have to update the usage of this function all the codebase <:

@xtcyclist
Copy link
Contributor Author

In this PR, I've checked all assignments of colNames. No bugs found. Considering that this PR changed too many files, I close it for now.

@xtcyclist xtcyclist closed this Dec 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-testing PR: ready for the CI test
Projects
None yet
4 participants