-
Notifications
You must be signed in to change notification settings - Fork 4
TEST: Test propagate_map_queries
pass
#6
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
Conversation
Let's leave make_term as-is. I'd like to be able to change the representation of the term under the hood, so that if we need to make the head an integer/enum later we still can. Could we instead change the tests here? |
fa2d86a
to
2612653
Compare
Sure! I reverted the changes. Can we keep two overrides of |
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.
Okay, I understand what's going on with make_term.
It should hold for all terms that
x == x.make_term(x.head(), *x.children())
Currently, this is not true for any of the terms that hold tuples of arguments.
You needed to override make_term to make this work for Plan and Mapjoin since those are the terms that got tested which hold tuples of arguments.
Could you override make_term so that the above invariant holds for all terms?
The whole problem originates from the fact that the only thing missing from Python class Plan(LogicNode):
bodies: tuple[LogicNode] = () and I think this is sufficient for our case, it's just something to keep in mind when rewriting Julia code. @classmethod
def make_term(cls, head, *args):
"""Creates a term with the given head and arguments."""
return head(*args) When constructing a |
The current overrides for tree-like nodes (or expr-like nodes here) make sure that this is valid, e.g.: @dataclass(eq=True, frozen=True)
class MapJoin(LogicNode):
@classmethod
def make_term(cls, head, op, *args):
return head(op, args) I can add a test for this! |
Thanks! |
I'll go ahead and merge it now, I'll add |
Hi @willow-ahrens,
I migrated
propagate_map_queries
test from my "draft autoscheduler" PR.To make sure the test passes I had to adjust
def make_term
forPlan
,Query
, andMapJoin
.My impression is that
x.make_term(x.head(), ...)
kind of duplicates information -x.head()
is more less acls
ofx
, right?I propose:
instead and override it (e.g.
Plan
) to make passing arguments more convenient.