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

Generate an plan base on the output #5437

Merged
merged 5 commits into from
Mar 28, 2023

Conversation

nevermore3
Copy link
Contributor

What type of PR is this?

  • bug
  • feature
  • enhancement

What problem(s) does this PR solve?

Issue(s) number:

Description:

How do you solve it?

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 .....

@nevermore3 nevermore3 added ready-for-testing PR: ready for the CI test ready for review labels Mar 24, 2023
@nevermore3 nevermore3 requested review from yixinglu and czpmango March 24, 2023 09:34
yixinglu
yixinglu previously approved these changes Mar 24, 2023
goCtx_->joinDst = true;
} else {
auto& name = static_cast<const VertexExpression*>(filterExpr)->name();
if (name == "VERTEX") {
Copy link
Contributor

Choose a reason for hiding this comment

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

Just return false if you dont care this scenario.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is code logic you should check elsewhere than here, IMHO.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

should report error if user input
go from ... yield vertex as v

Copy link
Contributor

Choose a reason for hiding this comment

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

Didn't the previous implementation check that, I mean you shouldn't mess with the logic of checking if there is an endpoint.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think checking whether there is information about the destination vertex and whether to joinDst is logically consistent and does not need to be implemented separately

Copy link
Contributor Author

Choose a reason for hiding this comment

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

got what's u mean

@nevermore3 nevermore3 force-pushed the fix_go_yield_dstproperty branch 2 times, most recently from 52cfb78 to b157103 Compare March 27, 2023 06:07
@nevermore3 nevermore3 force-pushed the fix_go_yield_dstproperty branch from b157103 to c9b552b Compare March 27, 2023 07:32
@nevermore3 nevermore3 requested review from yixinglu and czpmango March 27, 2023 09:12
Comment on lines +266 to +283
bool GoValidator::checkDstPropOrVertexExist(const Expression* expr) {
auto filterExprs = ExpressionUtils::collectAll(
expr, {Expression::Kind::kVertex, Expression::Kind::kDstProperty});
for (auto filterExpr : filterExprs) {
if (filterExpr->kind() == Expression::Kind::kDstProperty) {
goCtx_->joinDst = true;
} else {
auto& name = static_cast<const VertexExpression*>(filterExpr)->name();
if (name == "VERTEX") {
return false;
}
if (name == "$$") {
goCtx_->joinDst = true;
}
}
}
return true;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe this is better:

bool ExpressionUtils::existAnyDstVertex(const Expression* expr) {
    auto finder = [](const Expression* e) -> bool {
        return (e->kind() == ExprKind::kDstProperty) ||
               (e->kind == ExprKind::kVertex &&
                static_cast<const VertexExpression*>(e)->name() == "$$");
    }
    FindVisitor visitor(finder);
    const_cast<Expression*>(expr)->accept(&visitor);
    return !visitor.results().empty();
}

Copy link
Contributor

Choose a reason for hiding this comment

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

goCtx_->joinDst = ExpressionUtils::existAnyDstVertex(filter);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

although the functions are separated, it also causes repeated verification

@nevermore3 nevermore3 requested a review from codesigner March 27, 2023 17:07
@Sophie-Xie Sophie-Xie merged commit 8c3e8f6 into vesoft-inc:master Mar 28, 2023
@nevermore3 nevermore3 deleted the fix_go_yield_dstproperty branch March 29, 2023 02:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready for review ready-for-testing PR: ready for the CI test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants