-
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
feat: fn is_inversed, equivalent to typeid(e) < 0
#5692
base: master
Are you sure you want to change the base?
Conversation
@yixinglu , any chance we could bypass this lint error, please?
|
Maybe you could bypass it by splitting the function into some small functions, or disabling the 'readability/fn_size' rule in |
0e780fa
to
8e56f27
Compare
this is handy to check if an edge is scanned from its dst end or not.
8e56f27
to
463c0f2
Compare
split the huge function
463c0f2
to
2eb574b
Compare
cf2a7c2
to
be2bcdb
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.
LGTM
The failure now seems to be related to the instability of the test cases themself. |
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.
IMHO, the edge type id is an implementation level concept and cannot be used to simply indicate query semantics.
A possible approach is to use both the node id and the edge type id to determine the edge direction. The syntax might look like this:
|
Minor suggestion: It is better to commit the refactoring-related codes to another pr, which is also more review friendly. |
Yeah, agreed, mixing thing here is a little bit twisted, the way we treated
Maybe we could add both is_source_of(v_or_vid, e) and this function? Maybe we come out with a name that's more scrupulous than is_inversed?
Agreed! I'll create a separate PR for the refactor to be merged before this change! |
I dont think you can judge the edge direction simply by the sign of edge type id. |
This is how I may need this sugar, here WITH map{`true`: "-[", `false`: "<-["} AS arrow_l,
map{`true`: "]->", `false`: "]-"} AS arrow_r
MATCH (s)-[e:follow*..2]-() WHERE id(s) IN ["player100", "player101"]
WITH id(s) AS subj, [rel in e | [
arrow_l[tostring(typeid(rel) > 0)] +
tostring(rel.degree)+
arrow_r[tostring(typeid(rel) > 0)],
CASE typeid(rel) > 0
WHEN true THEN dst(rel)
WHEN false THEN src(rel)
END
]
] AS rels
WITH
subj,
REDUCE(acc = collect(NULL), l in rels | acc + l) AS flattened_rels
RETURN
subj,
REDUCE(acc = subj,l in flattened_rels|acc + ', ' + l) AS flattened_rels Where do I need to construct a knowledge sequence from path/edges, without getting the sign of typeid, there were some bad cases. |
How about that(probably be better performance):
std::string pathToString(Path p, std::vector<std::string> propNames={}) {
...
} |
make sense! |
this is handy to check if an edge is scanned
from its dst end or not.
What type of PR is this?
What problem(s) does this PR solve?
Issue(s) number:
Description:
The same edge could be treated as two because we persist one instance of edge in two places, see:
With is_inversed, we could detect those edges that are not expected in many cases.
How do you solve it?
Just yet another function returns bool:
typeid(e) < 0
.Special notes for your reviewer, ex. impact of this fix, design document, etc:
Document is needed.
Checklist:
Tests:
Affects:
Release notes:
Please confirm whether to be reflected in release notes and how to describe: