Skip to content

Conversation

@jingjingwang
Copy link
Contributor

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.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 9ed2b5a on recursively_apply_rules_as_list into ** on master**.

@jingjingwang jingjingwang requested a review from senderista July 26, 2017 19:50
Copy link
Contributor

@senderista senderista left a 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):
Copy link
Contributor

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was this a bug?

Copy link
Contributor

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):
Copy link
Contributor

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):
Copy link
Contributor

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):
Copy link
Contributor

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.
Copy link
Contributor

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]
Copy link
Contributor

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants