-
Notifications
You must be signed in to change notification settings - Fork 19
apply lists of rules recursively #570
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
|
Changes Unknown when pulling 9ed2b5a on recursively_apply_rules_as_list into ** on master**. |
senderista
left a 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.
mostly questions :)
| encounter a heavyweight operator.""" | ||
| if isinstance(op, MyriaAlgebra.fragment_leaves): | ||
| return op | ||
| if isinstance(op, algebra.Split): |
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.
was this a bug?
| # check if HC shuffle has been placed before | ||
| shuffled_child = [isinstance(op, algebra.HyperCubeShuffle) | ||
| shuffled_child = [isinstance(op, algebra.HyperCubeShuffle) or | ||
| isinstance(op, algebra.OrderBy) |
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.
was this a bug?
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.
wouldn't this only happen if OrderByBeforeNaryJoin was somehow applied before HCShuffleBeforeNaryJoin?
| def fire(self, expr): | ||
| if isinstance(expr, algebra.Scan) \ | ||
| and not isinstance(expr, GrappaFileScan): | ||
| and not isinstance(expr, cppcommon.CBaseFileScan): |
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.
was this a bug?
| result of the condition table""" | ||
|
|
||
| def fire(self, expr): | ||
| if isinstance(expr, GrappaDoWhile): |
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.
was this a bug?
| expr = recursiverule(expr) | ||
|
|
||
| for rules in rules_lists: | ||
| for i in range(20): |
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 this lands in an infinite recursion, it'll blow the python stack soon enough, right? Do we really need an explicit cutoff?
| # 5. push apply | ||
| push_apply = [ | ||
| # These really ought to be run until convergence. | ||
| # For now, run twice and finish with PushApply. |
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.
remove obsolete comment
|
|
||
| accessed = sorted(set(itertools.chain(*(accessed_columns(e) | ||
| for e in emits)))) | ||
| new_cols = [child.output_columns[p] for p in accessed] |
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.
could you explain why you removed all this code?
An algebra was defined as a list of lists of rules but then got flattened. This limits recursive optimizations that consist of multiple rules, for example, PushApply + RemoveUnusedColumn were repeated twice, which still produces redundant columns if the query contains more than two joins. This PR removes the flattening and applied a list of rules recursively until no change. It fixes the PushApply + RemoveUnusedColumn problem and also several bugs disclosed by this change.