You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Olivier Girardot (JIRA)" <ji...@apache.org> on 2015/05/22 10:05:17 UTC
[jira] [Commented] (SPARK-7322) Window function support in
Scala/Java DataFrame DSL
[ https://issues.apache.org/jira/browse/SPARK-7322?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14555811#comment-14555811 ]
Olivier Girardot commented on SPARK-7322:
-----------------------------------------
Thank you, that's great news !
> Window function support in Scala/Java DataFrame DSL
> ---------------------------------------------------
>
> Key: SPARK-7322
> URL: https://issues.apache.org/jira/browse/SPARK-7322
> Project: Spark
> Issue Type: Sub-task
> Components: SQL
> Reporter: Reynold Xin
> Assignee: Cheng Hao
> Labels: DataFrame
> Fix For: 1.4.0
>
>
> Here's a proposal for supporting window functions in the DataFrame DSL:
> 1. Add an over function to Column:
> {code}
> class Column {
> ...
> def over(window: Window): Column
> ...
> }
> {code}
> 2. Window:
> {code}
> object Window {
> def partitionBy(...): Window
> def orderBy(...): Window
> object Frame {
> def unbounded: Frame
> def preceding(n: Long): Frame
> def following(n: Long): Frame
> }
> class Frame
> }
> class Window {
> def orderBy(...): Window
> def rowsBetween(Frame, Frame): Window
> def rangeBetween(Frame, Frame): Window // maybe add this later
> }
> {code}
> Here's an example to use it:
> {code}
> df.select(
> avg(“age”).over(Window.partitionBy(“..”, “..”).orderBy(“..”, “..”)
> .rowsBetween(Frame.unbounded, Frame.currentRow))
> )
> df.select(
> avg(“age”).over(Window.partitionBy(“..”, “..”).orderBy(“..”, “..”)
> .rowsBetween(Frame.preceding(50), Frame.following(10)))
> )
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org