beliefer commented on a change in pull request #28685:
URL: https://github.com/apache/spark/pull/28685#discussion_r437999658



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/functions.scala
##########
@@ -993,6 +993,30 @@ object functions {
     Lead(e.expr, Literal(offset), Literal(defaultValue))
   }
 
+  /**
+   * Window function: returns the value that is the `offset`th row of the 
window frame
+   * (counting from 1), and `null` if the size of window frame is less than 
`offset` rows.
+   *
+   * This is equivalent to the nth_value function in SQL.
+   *
+   * @group window_funcs
+   * @since 3.0.0
+   */
+  def nth_value(columnName: String, offset: Int): Column = {

Review comment:
       They are existing two differences.
   The first is:
   The offset of `lag` based on the current row in the window. 
   The offset of `nth_value` based on the first row in the window. 
   The second is.
   The offset of `lag` increases from back to front.
   The offset of `nth_value` increases from front to back.




----------------------------------------------------------------
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]

Reply via email to