-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Fix rewrite edge node filter. #4815
Fix rewrite edge node filter. #4815
Conversation
Codecov ReportBase: 76.78% // Head: 76.84% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #4815 +/- ##
==========================================
+ Coverage 76.78% 76.84% +0.05%
==========================================
Files 1102 1102
Lines 80953 81001 +48
==========================================
+ Hits 62160 62242 +82
+ Misses 18793 18759 -34
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. |
Scenario: Order by after match | ||
When executing query: | ||
""" | ||
match (v)-[e:like|teammate{start_year: 2010}]->() where id(v) == 'Tim Duncan' return e |
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 openCypher, this edge filter means to find these edges which contain like or teammate labels and have the property start_year equal to 2010. So I think this filter should be converted to following format in NebulaGraph:
("like" in tags(e) and e.like.start_year = 2010) or ("teammate" in tags(e) and e.teammate.start_year=2010)
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 is not only *.prop = xxxx
, but we should have an equivalent representation of *.prop
of edge property consists multiple edge types.
@@ -41,6 +42,7 @@ std::unordered_map<std::string, Value::Type> FunctionManager::variadicFunReturnT | |||
{"concat_ws", Value::Type::STRING}, | |||
{"cos_similarity", Value::Type::FLOAT}, | |||
{"coalesce", Value::Type::__EMPTY__}, | |||
{"_any", Value::Type::__EMPTY__}, |
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 new added _any function, is it callable from query?
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.
Can't.
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.
If I understood correctly, it seems to me that you mean _all
, not _any
. If there are 10 edge types, all of which has the same prop: prop_x
, the semantics of any
could be satisfied if only 1 such prop_x
is found from all 10 edge types. all
means making sure and finding all prop_x
from all 10 edge types. I think you mean the latter one.
} | ||
static_cast<LogicalExpression *>(ret)->setOperands(std::move(operands)); | ||
ret = FunctionCallExpression::make(pool, "_any", args); |
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.
Why not just rewrite it as like.start_year==2010 or teammate.start_year==2010
?
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.
How about others?
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.
`like.start_year > xx' ?
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.
`like.start_year > xx' ?
This filter could not be used in path pattern. I don't understand the purpose of the _any
inner function.
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.
Storage don't support *.prop
, so rewrite it.
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.
Agree with @czpmango 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.
I think what @Shylock-Hg wants is a generic way. In the path pattern alone, however, rewriting with == suffices.
return arg.get(); | ||
} | ||
} | ||
return Value::kNullBadData; |
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.
kNullBadData
is designed for error andkNullValue
is sufficient for ignoring behavior. Fwiw, the bad null
should be passed through by all functions or expressions.
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.
What' your meaning?
44905d0
to
55fa604
Compare
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.
*.prop
equals to something like union(e1.prop, e2,prop ...)
semantically, not _any(e1.prop, e2,prop ...)
. Please make sure it's ok to change such semantics.
|
Please look at this issue: #4989 |
// Get any argument which is not empty/null | ||
{ | ||
auto &attr = functions_["_any"]; | ||
attr.minArity_ = 1; | ||
attr.maxArity_ = INT64_MAX; | ||
attr.isAlwaysPure_ = true; | ||
attr.body_ = [](const auto &args) -> Value { | ||
for (const auto &arg : args) { | ||
if (!arg.get().isNull() && !arg.get().empty()) { | ||
return arg.get(); | ||
} | ||
} | ||
return Value::kNullValue; | ||
}; | ||
} |
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 think _any
is very similar to the function
coalesce() | coalesce(input :: ANY?) :: (ANY?) | Returns the first non-null value in a list of expressions.
Both neo4j and nebula support it.
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.
ok
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.
Better to resuse it.
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.
We should ignore EMPTY
too.
What type of PR is this?
What problem(s) does this PR solve?
Issue(s) number:
Close https://github.com/vesoft-inc/nebula-ent/issues/1534
Close #4989
Description:
Rewrite edge property like
*.prop
to_any(e1.prop, e2,prop ...)
How do you solve it?
Special notes for your reviewer, ex. impact of this fix, design document, etc:
Checklist:
Tests:
Affects:
Release notes:
Please confirm whether to be reflected in release notes and how to describe: