HyukjinKwon commented on a change in pull request #30387: URL: https://github.com/apache/spark/pull/30387#discussion_r544762558
########## File path: sql/core/src/main/scala/org/apache/spark/sql/functions.scala ########## @@ -938,8 +938,40 @@ object functions { * @group window_funcs * @since 1.4.0 */ - def lag(e: Column, offset: Int, defaultValue: Any): Column = withExpr { - Lag(e.expr, Literal(offset), Literal(defaultValue)) + def lag(e: Column, offset: Int, defaultValue: Any): Column = { + lag(e, offset, defaultValue, false) + } + + /** + * Window function: returns the value that is `offset` rows before the current row, and + * `defaultValue` if there is less than `offset` rows before the current row. `ignoreNulls` + * determines whether null values of row are included in or eliminated from the calculation. + * For example, an `offset` of one will return the previous row at any given point in the + * window partition. + * + * This is equivalent to the LAG function in SQL. + * + * @group window_funcs + * @since 3.1.0 Review comment: BTW, let's target 3.2.0 ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org