-
Notifications
You must be signed in to change notification settings - Fork 106
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
SNOW-1491329 Support window functions in Snowpark IR #1914
SNOW-1491329 Support window functions in Snowpark IR #1914
Conversation
ast = proto.SpWindowSpecExpr() | ||
window_ast = with_src_position(ast.sp_window_spec_order_by) | ||
window_ast.wnd.CopyFrom(self._ast) | ||
for e in exprs: |
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.
there's some code duplication here, could use helper function. For now kept as is to not introduce complexity.
tests/ast/data/windows.test
Outdated
|
||
res2 = res1.select(col("NUM").as_("key"), col("STR").as_("value")) | ||
|
||
res3 = res2.select(avg(col("value")).over(Window.partition_by(col("value")).order_by(col("key")).rows_between(0, 2)).as_("window1"), avg(col("value")).over(Window.order_by(col("key").desc()).range_between(-9223372036854775807, 9223372036854775807)).as_("window2")) |
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.
Note here that the constants Window.CURRENT_ROW
are internally labels for integers. I left a comment here https://github.com/snowflakedb/snowflake/pull/194828/files#r1679926588 to discuss strategies.
ebe4503
into
server-side-snowpark
Support window functions/expressions in Snowpark IR.