cloud-fan commented on a change in pull request #30387:
URL: https://github.com/apache/spark/pull/30387#discussion_r526949480
##########
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
+ */
+ def lag(columnName: String, offset: Int, defaultValue: Any, ignoreNulls:
Boolean): Column = {
Review comment:
Shall we stop adding function overloads with string as column parameter?
cc @HyukjinKwon
----------------------------------------------------------------
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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]