Github user jaceklaskowski commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14284#discussion_r71781038
  
    --- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/execution/SQLWindowFunctionSuite.scala
 ---
    @@ -357,14 +356,59 @@ class SQLWindowFunctionSuite extends QueryTest with 
SQLTestUtils with TestHiveSi
       }
     
       test("SPARK-7595: Window will cause resolve failed with self join") {
    -    sql("SELECT * FROM src") // Force loading of src table.
    -
         checkAnswer(sql(
           """
             |with
    -        | v1 as (select key, count(value) over (partition by key) cnt_val 
from src),
    +        | v0 as (select 0 as key, 1 as value),
    +        | v1 as (select key, count(value) over (partition by key) cnt_val 
from v0),
             | v2 as (select v1.key, v1_lag.cnt_val from v1, v1 v1_lag where 
v1.key = v1_lag.key)
    -        | select * from v2 order by key limit 1
    -      """.stripMargin), Row(0, 3))
    +        | select key, cnt_val from v2 order by key limit 1
    +      """.stripMargin), Row(0, 1))
    +  }
    +
    +  test("lead/lag should return the default value if the offset row does 
not exist") {
    +    checkAnswer(sql(
    +      """
    +        |SELECT
    +        |  lag(123, 100, 321) OVER (ORDER BY id) as lag,
    +        |  lead(123, 100, 321) OVER (ORDER BY id) as lead
    +        |FROM (SELECT 1 as id) tmp
    +      """.stripMargin),
    +      Row(321, 321))
    +
    +    checkAnswer(sql(
    +      """
    +        |SELECT
    +        |  lag(123, 100, a) OVER (ORDER BY id) as lag,
    +        |  lead(123, 100, a) OVER (ORDER BY id) as lead
    +        |FROM (SELECT 1 as id, 2 as a) tmp
    +      """.stripMargin),
    +      Row(2, 2))
    +  }
    +
    +  test("lead/lag should be able to handle null input value correctly") {
    --- End diff --
    
    I don't think "correctly" is needed here.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to