Skip to content
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

Merged
merged 2 commits into from
Feb 25, 2025

Conversation

tobymao
Copy link
Contributor

@tobymao tobymao commented Feb 21, 2025

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.

@tobymao tobymao requested a review from izeigerman February 21, 2025 00:26
@tobymao tobymao force-pushed the toby/get_removal_interval branch 4 times, most recently from eabd032 to e9f37da Compare February 21, 2025 06:21
@tobymao tobymao requested a review from eakmanrq February 21, 2025 06:40
@tobymao tobymao force-pushed the toby/get_removal_interval branch from 9d98fb8 to 0f96c9e Compare February 22, 2025 03:59
@tobymao tobymao force-pushed the toby/get_removal_interval branch 5 times, most recently from b37ff4d to ba97893 Compare February 24, 2025 20:51

if not restating_parents and snapshot.name not in restate_models:
continue
if not removal_interval:
Copy link
Member

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?

Copy link
Member

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?

Copy link
Contributor Author

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

Copy link
Contributor Author

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:
Copy link
Member

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?

Copy link
Member

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.

Copy link
Contributor Author

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

@tobymao tobymao force-pushed the toby/get_removal_interval branch 3 times, most recently from 4ecff8d to 0aeb1a9 Compare February 25, 2025 03:15
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.
@tobymao tobymao force-pushed the toby/get_removal_interval branch from 0aeb1a9 to 84df3ce Compare February 25, 2025 05:43
@tobymao tobymao enabled auto-merge (squash) February 25, 2025 05:43
@tobymao tobymao merged commit f01e9f2 into main Feb 25, 2025
20 of 21 checks passed
@tobymao tobymao deleted the toby/get_removal_interval branch February 25, 2025 05:52
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.

2 participants