-
Notifications
You must be signed in to change notification settings - Fork 608
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(ir): merge window frames for bound analytic window functions with a subsequent over call #7790
Conversation
2b283fd
to
2c02b3b
Compare
@@ -48,10 +50,24 @@ def test_value_over_api(alltypes): | |||
w1 = ibis.window(rows=(0, 1), group_by=t.g, order_by=[t.f, t.h]) | |||
w2 = ibis.window(range=(-1, 1), group_by=[t.g, t.a], order_by=[t.f]) | |||
|
|||
expr = t.f.cumsum().over(rows=(0, 1), group_by=t.g, order_by=[t.f, t.h]) |
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.
I think we have been misinterpreting this scenario because we used the cumulative_window()
frame constructed in the cumsum()
call, but we also provided explicit rows window boundaries. I changed the behaviour to raise due to window frame boundary conflict.
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.
Yeah, that makes sense to me.
38e3239
to
3d129f9
Compare
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.
Small change request, but otherwise LGTM!
@@ -48,10 +50,24 @@ def test_value_over_api(alltypes): | |||
w1 = ibis.window(rows=(0, 1), group_by=t.g, order_by=[t.f, t.h]) | |||
w2 = ibis.window(range=(-1, 1), group_by=[t.g, t.a], order_by=[t.f]) | |||
|
|||
expr = t.f.cumsum().over(rows=(0, 1), group_by=t.g, order_by=[t.f, t.h]) |
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.
Yeah, that makes sense to me.
3d129f9
to
50fae67
Compare
50fae67
to
c51e224
Compare
Might need to regen some code in the cloud backends, lemme see. |
Fixes #7631
#7327 removed the argument of the relevant analytic functions and changed the value methods to return with a
WindowFunction
with a frame ordered by the value. When.over()
is called on a window function the window frames were not merged, while we had that functionality it was only used by thetable.group_by().select(reduction | analytic)
API calls (theGroupedTable
helper object).This PR changes the
.over()
method to merge the window builder provided in the call with the window already existing in the expression if any. It also deduplicates theorder_by
andgroup_by
expressions during merge now.