-
Notifications
You must be signed in to change notification settings - Fork 191
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: prevent get_removal_interval from returning invalid interval #3879
Conversation
eabd032
to
e9f37da
Compare
9d98fb8
to
0f96c9e
Compare
b37ff4d
to
ba97893
Compare
sqlmesh/core/plan/builder.py
Outdated
|
||
if not restating_parents and snapshot.name not in restate_models: | ||
continue | ||
if not removal_interval: |
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.
This doesn't look correct. What if removal_interval
is empty, but restating_parents
is not?
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.
Shouldn't this be
if not possible_intervals
instead?
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.
this used to be true before interval expansion, because we wanted to have daily parents restate, but not the monthly. i think this doesn't make sense anymore
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.
updated
self._context_diff.snapshots[s] for s in snapshot.parents if s in restatements | ||
] | ||
|
||
if not restating_parents and snapshot.name not in restate_models: |
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.
Should we do
removal_interval = snapshot.get_removal_interval(
after this check and not before?
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.
Btw, this check doesn't seem useful, since restating_parents
doesn't filter out non-incremental models. So restating_models
might be non-empty, but then possible_intervals
will be empty.
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.
possible_intervals can be empty because parents are full, but get_removal_interval should always exist with expansion
4ecff8d
to
0aeb1a9
Compare
if your partial restate a daily model -> monthly, (2024-02-15, 2024-02-20), get_removal_interval returned an interval where start > end. this ensures get_removal_interval only returns valid intervals.
0aeb1a9
to
84df3ce
Compare
if your partial restate a daily model -> monthly, (2024-02-15, 2024-02-20), get_removal_interval returned an interval where start > end. this ensures get_removal_interval only returns valid intervals.