You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by jinxing64 <gi...@git.apache.org> on 2017/07/14 06:16:01 UTC

[GitHub] spark pull request #18634: [SPARK-21414] Refine SlidingWindowFunctionFrame t...

GitHub user jinxing64 opened a pull request:

    https://github.com/apache/spark/pull/18634

    [SPARK-21414] Refine SlidingWindowFunctionFrame to avoid OOM.

    ## What changes were proposed in this pull request?
    
    In `SlidingWindowFunctionFrame`, it is now adding all rows to the buffer for which the input row value is equal to or less than the output row upper bound, then drop all rows from the buffer for which the input row value is smaller than the output row lower bound.
    This could result in the buffer is very big though the window is small.
    For example: 
    ```
    select a, b, sum(a) 
    over (partition by b order by a range between 1000000 following and 1000001 following) 
    from table
    ```
    We can refine the logic and just add the qualified rows into buffer.
    
    ## How was this patch tested?
    Added test.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/jinxing64/spark SPARK-21414

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/18634.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #18634
    
----
commit 5103ae80d456ca26c7b853f99e73c4a2c152ad41
Author: jinxing <ji...@126.com>
Date:   2017-07-12T12:02:28Z

    Refine SlidingWindowFunctionFrame to avoid OOM.

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18634: [SPARK-21414] Refine SlidingWindowFunctionFrame to avoid...

Posted by jinxing64 <gi...@git.apache.org>.
Github user jinxing64 commented on the issue:

    https://github.com/apache/spark/pull/18634
  
    @jiangxb1987 Thanks a lot for quick reply !
    
    > One concern is the test case don't reflect the improvement of this change.
    
    Yes, there is no unit test for `WindowFunctionFrame` now. The test case I added is just to check the correctness.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18634: [SPARK-21414] Refine SlidingWindowFunctionFrame to avoid...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18634
  
    **[Test build #79753 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/79753/testReport)** for PR 18634 at commit [`b33c4cf`](https://github.com/apache/spark/commit/b33c4cff3b1ac132552e20b007c587e3f1e2b042).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18634: [SPARK-21414] Refine SlidingWindowFunctionFrame t...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/spark/pull/18634


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18634: [SPARK-21414] Refine SlidingWindowFunctionFrame t...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18634#discussion_r128228043
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/execution/SQLWindowFunctionSuite.scala ---
    @@ -359,37 +359,41 @@ class SQLWindowFunctionSuite extends QueryTest with SharedSQLContext {
       test("window function: mutiple window expressions specified by range in a single expression") {
         val nums = sparkContext.parallelize(1 to 10).map(x => (x, x % 2)).toDF("x", "y")
         nums.createOrReplaceTempView("nums")
    -
    -    val expected =
    -      Row(1, 1, 1, 4, 25) ::
    -        Row(1, 3, 4, 9, 24) ::
    -        Row(1, 5, 9, 15, 21) ::
    -        Row(1, 7, 16, 21, 16) ::
    -        Row(1, 9, 25, 16, 9) ::
    -        Row(0, 2, 2, 6, 30) ::
    -        Row(0, 4, 6, 12, 28) ::
    -        Row(0, 6, 12, 18, 24) ::
    -        Row(0, 8, 20, 24, 18) ::
    -        Row(0, 10, 30, 18, 10) ::
    -        Nil
    -
    -    val actual = sql(
    -      """
    -        |SELECT
    -        |  y,
    -        |  x,
    -        |  sum(x) over w1 as history_sum,
    -        |  sum(x) over w2 as period_sum,
    -        |  sum(x) over w3 as future_sum
    -        |FROM nums
    -        |WINDOW w1 AS (PARTITION BY y ORDER BY x RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW),
    -        |       w2 AS (PARTITION BY y ORDER BY x RANGE BETWEEN 2 PRECEDING AND 2 FOLLOWING),
    -        |       w3 AS (PARTITION BY y ORDER BY x RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING)
    -      """.stripMargin
    -    )
    -
    -    checkAnswer(actual, expected)
    -    spark.catalog.dropTempView("nums")
    +    withTempView("nums") {
    +      val expected =
    +        Row(1, 1, 1, 4, null, 8, 25) ::
    --- End diff --
    
    null is better, which matches the behavior in Aggregate.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18634: [SPARK-21414] Refine SlidingWindowFunctionFrame t...

Posted by jinxing64 <gi...@git.apache.org>.
Github user jinxing64 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18634#discussion_r128215724
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/execution/SQLWindowFunctionSuite.scala ---
    @@ -359,37 +359,41 @@ class SQLWindowFunctionSuite extends QueryTest with SharedSQLContext {
       test("window function: mutiple window expressions specified by range in a single expression") {
         val nums = sparkContext.parallelize(1 to 10).map(x => (x, x % 2)).toDF("x", "y")
         nums.createOrReplaceTempView("nums")
    -
    -    val expected =
    -      Row(1, 1, 1, 4, 25) ::
    -        Row(1, 3, 4, 9, 24) ::
    -        Row(1, 5, 9, 15, 21) ::
    -        Row(1, 7, 16, 21, 16) ::
    -        Row(1, 9, 25, 16, 9) ::
    -        Row(0, 2, 2, 6, 30) ::
    -        Row(0, 4, 6, 12, 28) ::
    -        Row(0, 6, 12, 18, 24) ::
    -        Row(0, 8, 20, 24, 18) ::
    -        Row(0, 10, 30, 18, 10) ::
    -        Nil
    -
    -    val actual = sql(
    -      """
    -        |SELECT
    -        |  y,
    -        |  x,
    -        |  sum(x) over w1 as history_sum,
    -        |  sum(x) over w2 as period_sum,
    -        |  sum(x) over w3 as future_sum
    -        |FROM nums
    -        |WINDOW w1 AS (PARTITION BY y ORDER BY x RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW),
    -        |       w2 AS (PARTITION BY y ORDER BY x RANGE BETWEEN 2 PRECEDING AND 2 FOLLOWING),
    -        |       w3 AS (PARTITION BY y ORDER BY x RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING)
    -      """.stripMargin
    -    )
    -
    -    checkAnswer(actual, expected)
    -    spark.catalog.dropTempView("nums")
    +    withTempView("nums") {
    +      val expected =
    +        Row(1, 1, 1, 4, null, 8, 25) ::
    --- End diff --
    
    @cloud-fan 
    This is null and do you think 0 is better?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18634: [SPARK-21414] Refine SlidingWindowFunctionFrame to avoid...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on the issue:

    https://github.com/apache/spark/pull/18634
  
    @jinxing64 I think this patch is straightforward, can you do a manual test, which OOM before and works after this PR? We can put the test in PR description so that other people can try it out.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18634: [SPARK-21414] Refine SlidingWindowFunctionFrame t...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18634#discussion_r127882358
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/execution/SQLWindowFunctionSuite.scala ---
    @@ -356,6 +356,42 @@ class SQLWindowFunctionSuite extends QueryTest with SharedSQLContext {
         spark.catalog.dropTempView("nums")
       }
     
    +  test("window function: mutiple window expressions specified by range in a single expression") {
    +    val nums = sparkContext.parallelize(1 to 10).map(x => (x, x % 2)).toDF("x", "y")
    +    nums.createOrReplaceTempView("nums")
    --- End diff --
    
    wrap your test with `withTempView`, which can drop the view automatically.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18634: [SPARK-21414] Refine SlidingWindowFunctionFrame to avoid...

Posted by jinxing64 <gi...@git.apache.org>.
Github user jinxing64 commented on the issue:

    https://github.com/apache/spark/pull/18634
  
    @cloud-fan @jiangxb1987 
    Thanks for help! I will refine and post the result of manual test late today :)


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18634: [SPARK-21414] Refine SlidingWindowFunctionFrame t...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18634#discussion_r127882430
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/execution/SQLWindowFunctionSuite.scala ---
    @@ -356,6 +356,42 @@ class SQLWindowFunctionSuite extends QueryTest with SharedSQLContext {
         spark.catalog.dropTempView("nums")
       }
     
    +  test("window function: mutiple window expressions specified by range in a single expression") {
    +    val nums = sparkContext.parallelize(1 to 10).map(x => (x, x % 2)).toDF("x", "y")
    +    nums.createOrReplaceTempView("nums")
    --- End diff --
    
    BTW this test is not very related to this PR, just adds test coverage for range window frame.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18634: [SPARK-21414] Refine SlidingWindowFunctionFrame to avoid...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18634
  
    Merged build finished. Test PASSed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18634: [SPARK-21414] Refine SlidingWindowFunctionFrame t...

Posted by jinxing64 <gi...@git.apache.org>.
Github user jinxing64 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18634#discussion_r128142152
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/execution/SQLWindowFunctionSuite.scala ---
    @@ -356,6 +356,42 @@ class SQLWindowFunctionSuite extends QueryTest with SharedSQLContext {
         spark.catalog.dropTempView("nums")
       }
     
    +  test("window function: mutiple window expressions specified by range in a single expression") {
    +    val nums = sparkContext.parallelize(1 to 10).map(x => (x, x % 2)).toDF("x", "y")
    +    nums.createOrReplaceTempView("nums")
    --- End diff --
    
    Sure, I will add it later today.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18634: [SPARK-21414] Refine SlidingWindowFunctionFrame to avoid...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18634
  
    **[Test build #79671 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/79671/testReport)** for PR 18634 at commit [`1ebb211`](https://github.com/apache/spark/commit/1ebb2111b914e7568e7c34ef54bafb8870c33682).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18634: [SPARK-21414] Refine SlidingWindowFunctionFrame to avoid...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18634
  
    **[Test build #79605 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/79605/testReport)** for PR 18634 at commit [`5103ae8`](https://github.com/apache/spark/commit/5103ae80d456ca26c7b853f99e73c4a2c152ad41).


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18634: [SPARK-21414] Refine SlidingWindowFunctionFrame to avoid...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18634
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/79753/
    Test PASSed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18634: [SPARK-21414] Refine SlidingWindowFunctionFrame to avoid...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18634
  
    **[Test build #79605 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/79605/testReport)** for PR 18634 at commit [`5103ae8`](https://github.com/apache/spark/commit/5103ae80d456ca26c7b853f99e73c4a2c152ad41).
     * This patch **fails due to an unknown error code, -9**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18634: [SPARK-21414] Refine SlidingWindowFunctionFrame to avoid...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18634
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/79608/
    Test PASSed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18634: [SPARK-21414] Refine SlidingWindowFunctionFrame to avoid...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18634
  
    **[Test build #79608 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/79608/testReport)** for PR 18634 at commit [`5103ae8`](https://github.com/apache/spark/commit/5103ae80d456ca26c7b853f99e73c4a2c152ad41).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18634: [SPARK-21414] Refine SlidingWindowFunctionFrame t...

Posted by jiangxb1987 <gi...@git.apache.org>.
Github user jiangxb1987 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18634#discussion_r127696829
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/window/WindowFunctionFrame.scala ---
    @@ -212,6 +203,21 @@ private[window] final class SlidingWindowFunctionFrame(
           bufferUpdated = true
         }
     
    +    // Add all rows to the buffer for which the input row value is equal to or less than
    +    // the output row upper bound.
    +    while (nextRow != null && ubound.compare(nextRow, inputHighIndex, current, index) <= 0) {
    --- End diff --
    
    How about:
    ```
         while (nextRow != null && ubound.compare(nextRow, inputHighIndex, current, index) <= 0) {
           if (lbound.compare(nextRow, inputLowIndex, current, index) < 0) {
             inputLowIndex += 1
           } else {
             buffer.add(nextRow.copy())
             bufferUpdated = true
           }
           nextRow = WindowFunctionFrame.getNextOrNull(inputIterator)
           inputHighIndex += 1
         }
    ```
    ?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18634: [SPARK-21414] Refine SlidingWindowFunctionFrame t...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18634#discussion_r128220833
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/execution/SQLWindowFunctionSuite.scala ---
    @@ -356,6 +356,46 @@ class SQLWindowFunctionSuite extends QueryTest with SharedSQLContext {
         spark.catalog.dropTempView("nums")
       }
     
    +  test("window function: mutiple window expressions specified by range in a single expression") {
    +    val nums = sparkContext.parallelize(1 to 10).map(x => (x, x % 2)).toDF("x", "y")
    +    nums.createOrReplaceTempView("nums")
    +    withTempView("nums") {
    +      val expected =
    +        Row(1, 1, 1, 4, null, 8, 25) ::
    +          Row(1, 3, 4, 9, 1, 12, 24) ::
    +          Row(1, 5, 9, 15, 4, 16, 21) ::
    +          Row(1, 7, 16, 21, 8, 9, 16) ::
    +          Row(1, 9, 25, 16, 12, null, 9) ::
    +          Row(0, 2, 2, 6, null, 10, 30) ::
    +          Row(0, 4, 6, 12, 2, 14, 28) ::
    +          Row(0, 6, 12, 18, 6, 18, 24) ::
    +          Row(0, 8, 20, 24, 10, 10, 18) ::
    +          Row(0, 10, 30, 18, 14, null, 10) ::
    --- End diff --
    
    BTW, please make sure there is no behavior change, i.e. the result should be same with or without this PR.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18634: [SPARK-21414] Refine SlidingWindowFunctionFrame to avoid...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18634
  
    Merged build finished. Test PASSed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18634: [SPARK-21414] Refine SlidingWindowFunctionFrame to avoid...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18634
  
    Merged build finished. Test PASSed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18634: [SPARK-21414] Refine SlidingWindowFunctionFrame to avoid...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18634
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/79605/
    Test FAILed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18634: [SPARK-21414] Refine SlidingWindowFunctionFrame to avoid...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18634
  
    **[Test build #79671 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/79671/testReport)** for PR 18634 at commit [`1ebb211`](https://github.com/apache/spark/commit/1ebb2111b914e7568e7c34ef54bafb8870c33682).


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18634: [SPARK-21414] Refine SlidingWindowFunctionFrame to avoid...

Posted by jinxing64 <gi...@git.apache.org>.
Github user jinxing64 commented on the issue:

    https://github.com/apache/spark/pull/18634
  
    retest please


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18634: [SPARK-21414] Refine SlidingWindowFunctionFrame t...

Posted by jinxing64 <gi...@git.apache.org>.
Github user jinxing64 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18634#discussion_r128227194
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/execution/SQLWindowFunctionSuite.scala ---
    @@ -356,6 +356,46 @@ class SQLWindowFunctionSuite extends QueryTest with SharedSQLContext {
         spark.catalog.dropTempView("nums")
       }
     
    +  test("window function: mutiple window expressions specified by range in a single expression") {
    +    val nums = sparkContext.parallelize(1 to 10).map(x => (x, x % 2)).toDF("x", "y")
    +    nums.createOrReplaceTempView("nums")
    +    withTempView("nums") {
    +      val expected =
    +        Row(1, 1, 1, 4, null, 8, 25) ::
    +          Row(1, 3, 4, 9, 1, 12, 24) ::
    +          Row(1, 5, 9, 15, 4, 16, 21) ::
    +          Row(1, 7, 16, 21, 8, 9, 16) ::
    +          Row(1, 9, 25, 16, 12, null, 9) ::
    +          Row(0, 2, 2, 6, null, 10, 30) ::
    +          Row(0, 4, 6, 12, 2, 14, 28) ::
    +          Row(0, 6, 12, 18, 6, 18, 24) ::
    +          Row(0, 8, 20, 24, 10, 10, 18) ::
    +          Row(0, 10, 30, 18, 14, null, 10) ::
    --- End diff --
    
    `expected` is calculated manually. This test is to verify there is no behavior change.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18634: [SPARK-21414] Refine SlidingWindowFunctionFrame to avoid...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on the issue:

    https://github.com/apache/spark/pull/18634
  
    LGTM


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18634: [SPARK-21414] Refine SlidingWindowFunctionFrame to avoid...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on the issue:

    https://github.com/apache/spark/pull/18634
  
    thanks, merging to master/2.2!


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18634: [SPARK-21414] Refine SlidingWindowFunctionFrame t...

Posted by jiangxb1987 <gi...@git.apache.org>.
Github user jiangxb1987 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18634#discussion_r127882623
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/execution/SQLWindowFunctionSuite.scala ---
    @@ -356,6 +356,42 @@ class SQLWindowFunctionSuite extends QueryTest with SharedSQLContext {
         spark.catalog.dropTempView("nums")
       }
     
    +  test("window function: mutiple window expressions specified by range in a single expression") {
    +    val nums = sparkContext.parallelize(1 to 10).map(x => (x, x % 2)).toDF("x", "y")
    +    nums.createOrReplaceTempView("nums")
    --- End diff --
    
    And this test case doesn't cover when CurrentRow is not in the window frame. We'd better add that senario.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18634: [SPARK-21414] Refine SlidingWindowFunctionFrame to avoid...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18634
  
    Merged build finished. Test FAILed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18634: [SPARK-21414] Refine SlidingWindowFunctionFrame to avoid...

Posted by jinxing64 <gi...@git.apache.org>.
Github user jinxing64 commented on the issue:

    https://github.com/apache/spark/pull/18634
  
    Jenkins, retest this please.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18634: [SPARK-21414] Refine SlidingWindowFunctionFrame to avoid...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18634
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/79671/
    Test PASSed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18634: [SPARK-21414] Refine SlidingWindowFunctionFrame to avoid...

Posted by jinxing64 <gi...@git.apache.org>.
Github user jinxing64 commented on the issue:

    https://github.com/apache/spark/pull/18634
  
    cc @cloud-fan @jiangxb1987 


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18634: [SPARK-21414] Refine SlidingWindowFunctionFrame to avoid...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18634
  
    **[Test build #79608 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/79608/testReport)** for PR 18634 at commit [`5103ae8`](https://github.com/apache/spark/commit/5103ae80d456ca26c7b853f99e73c4a2c152ad41).


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18634: [SPARK-21414] Refine SlidingWindowFunctionFrame to avoid...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18634
  
    **[Test build #79753 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/79753/testReport)** for PR 18634 at commit [`b33c4cf`](https://github.com/apache/spark/commit/b33c4cff3b1ac132552e20b007c587e3f1e2b042).


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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