-
Notifications
You must be signed in to change notification settings - Fork 15
Support subquery EXISTS. #83
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
base: master
Are you sure you want to change the base?
Conversation
CodSpeed Performance ReportMerging #83 will not alter performanceComparing Summary
|
dac2001 to
4b6e8ba
Compare
|
This will be one of the ambitious PR. In order to support subquery, I restructure the code base a little bit
In general, I think subquery will have better performance in many case. One case I can think of is Match p = (A:Node) -[:depend*1..10]->(B:Node {name="BNode") <-[:depend*1..10]- (C:Node)
where p EXISTS {
(A:Node) -[:version*1..10]->(C:Node)
}
return A, CI suppose, the subquery only need to search on a subset from the main query via hints. Of course, I haven't reached this stage yet. P.S. I think the code base needs better concepts, or it will soon go out of control. |
|
The logic to enter/exit subquery stack are:
|
|
This is so exciting!! And more broadly I'm really excited about your refactor,
This is SO TRUE. I started this repository before I really understood how to think about and organize Lark projects, and... well, I haven't gotten much better since then :) Would love to discuss together and hear what you're thinking, I would love for this to have dramatically less complexity and spaghetti-code than I gave it to start!! |
fa3627f to
cc63171
Compare
sample:
qry = """
MATCH (A)
where A EXISTS {
MATCH (A) --> (B)
where B EXISTS {
MATCH (B)
where B.age > 40
}
}
RETURN ID(A)
"""
|
I improved
|
|
I think I just give support for negated edge using subquery MATCH (A) --> (B)
where NOT EXISTS {
MATCH (A) -[r:XY]-> (B)
where r.name = "XY"
return A, r, B
}
RETURN ID(A), ID(B)However, It doesn't work with node label query, It will take me sometime to debug MATCH (A) --> (B)
where NOT EXISTS {
MATCH (A) -[:XY]-> (B)
return A, r, B
}
RETURN ID(A), ID(B) |
|
I found the problem, it's the #84 now negated edge in subquery works just fine. |
- check if node and edge from hints are valid matches
sample:
qry = """
MATCH (A)
where A EXISTS {
MATCH (A) --> (B)
where B EXISTS {
MATCH (B)
where B.age > 40
return ID(B)
}
return ID(A)
}
RETURN ID(A)
"""