-
Notifications
You must be signed in to change notification settings - Fork 608
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(internals): ensure that CTEs are emitted in topological order #9726
Conversation
I don't see anything concerning here, eyeballing each benchmark There are some apparent slowdowns with expression equality on the order of 20%, but since the
|
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.
Nice fix. Just a small nit on type annotations, otherwise LGTM.
Co-authored-by: Jim Crist-Harif <jcristharif@gmail.com>
Description of changes
This PR fixes an issue reported at least twice on Zulip:
Here
most recently, and
here
a while back.
The issue was that we weren't emitting CTEs (common table expressions) in topological order,
because our
find
API onNode
s didn't order its output topologically.This meant that sometimes nodes would be in topological order because that's
the way the query was constructed but in the case of queries with a graph
structure (more than one shared dependent) child nodes would be emitted before parents.
I added a flag,
ordered
to thefind
method to address the specific use caseand then passed
ordered=True
at the call site.I'll run the benchmarks locally to make sure this doesn't introduce a huge
performance regression, since the sort will happen on every call to
translate
even if there end up being no found
CTE
s.Issues closed
None that are open on GitHub, just those discussed on Zulip.