You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by liutang123 <gi...@git.apache.org> on 2018/07/15 12:02:46 UTC

[GitHub] spark pull request #21772: [SPARK-24809] [SQL] Serializing LongHashedRelatio...

GitHub user liutang123 opened a pull request:

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

    [SPARK-24809] [SQL] Serializing LongHashedRelation in executor may result in data error

    When join key is long or int in broadcast join, Spark will use LongHashedRelation as the broadcast value. Details see SPARK-14419. But, if the broadcast value is abnormal big, executor will serialize it to disk. But, data will lost when serializing.
    A flow chart [see](http://oi67.tinypic.com/2z5pzs7.jpg)
    
    ## What changes were proposed in this pull request?
    Write cursor instead when serializing and setting cursor value when deserializing.
    
    ## How was this patch tested?
    manual test.


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

    $ git pull https://github.com/liutang123/spark SPARK-24809

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

    https://github.com/apache/spark/pull/21772.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 #21772
    
----
commit a72fe61863e119c0e902cef3054d9140b6d04f77
Author: liulijia <li...@...>
Date:   2018-07-15T11:24:55Z

    [SPARK-24809] [SQL] Serializing LongHashedRelation in executor may result in data error

----


---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongToUnsafeRowMap in ex...

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

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


---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongToUnsafeRowMap in ex...

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

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


---

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


[GitHub] spark pull request #21772: [SPARK-24809] [SQL] Serializing LongToUnsafeRowMa...

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/21772#discussion_r205929311
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/execution/joins/HashedRelationSuite.scala ---
    @@ -278,6 +278,36 @@ class HashedRelationSuite extends SparkFunSuite with SharedSQLContext {
         map.free()
       }
     
    +  test("SPARK-24809: Serializing LongToUnsafeRowMap in executor may result in data error") {
    +    val unsafeProj = UnsafeProjection.create(Array[DataType](LongType))
    +    val originalMap = new LongToUnsafeRowMap(mm, 1)
    +
    +    val key1 = 1L
    +    val value1 = 4852306286022334418L
    +
    +    val key2 = 2L
    +    val value2 = 8813607448788216010L
    +
    +    originalMap.append(key1, unsafeProj(InternalRow(value1)))
    +    originalMap.append(key2, unsafeProj(InternalRow(value2)))
    +    originalMap.optimize()
    +
    +    val ser = new KryoSerializer(
    --- End diff --
    
    we can write `sparkContext.env.serializer.newInstance()`


---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongHashedRelation in ex...

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

    https://github.com/apache/spark/pull/21772
  
    @hvanhovell Thanks for reviewing. Losing data because the variable **cursor** in executor is 0 and serialization depends on it. I will add an UT later.


---

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


[GitHub] spark pull request #21772: [SPARK-24809] [SQL] Serializing LongHashedRelatio...

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

    https://github.com/apache/spark/pull/21772#discussion_r204617884
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/joins/HashedRelation.scala ---
    @@ -772,6 +772,8 @@ private[execution] final class LongToUnsafeRowMap(val mm: TaskMemoryManager, cap
         array = readLongArray(readBuffer, length)
         val pageLength = readLong().toInt
         page = readLongArray(readBuffer, pageLength)
    +    // Set cursor because cursor is used in write function.
    --- End diff --
    
    maybe: `Restore cursor variable to make this map able to be serialized again on executors`?


---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongHashedRelation in ex...

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

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


---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongHashedRelation in ex...

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

    https://github.com/apache/spark/pull/21772
  
    @viirya Hi, Could you have more time to review this PR?


---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongHashedRelation in ex...

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

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


---

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


[GitHub] spark pull request #21772: [SPARK-24809] [SQL] Serializing LongHashedRelatio...

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

    https://github.com/apache/spark/pull/21772#discussion_r204618320
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/execution/joins/HashedRelationSuite.scala ---
    @@ -278,6 +278,39 @@ class HashedRelationSuite extends SparkFunSuite with SharedSQLContext {
         map.free()
       }
     
    +  test("SPARK-24809: Serializing LongHashedRelation in executor may result in data error") {
    +    val unsafeProj = UnsafeProjection.create(Array[DataType](LongType))
    +    val originalMap = new LongToUnsafeRowMap(mm, 1)
    +
    +    val key1 = 1L
    +    val value1 = new Random().nextLong()
    +
    +    val key2 = 2L
    +    val value2 = new Random().nextLong()
    --- End diff --
    
    Is it necessary to use `Random` here? Can we use two arbitrary long values?


---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongToUnsafeRowMap in ex...

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

    https://github.com/apache/spark/pull/21772
  
    Jenkins, test this please


---

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


[GitHub] spark pull request #21772: [SPARK-24809] [SQL] Serializing LongHashedRelatio...

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

    https://github.com/apache/spark/pull/21772#discussion_r204618927
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/execution/joins/HashedRelationSuite.scala ---
    @@ -278,6 +278,39 @@ class HashedRelationSuite extends SparkFunSuite with SharedSQLContext {
         map.free()
       }
     
    +  test("SPARK-24809: Serializing LongHashedRelation in executor may result in data error") {
    +    val unsafeProj = UnsafeProjection.create(Array[DataType](LongType))
    +    val originalMap = new LongToUnsafeRowMap(mm, 1)
    +
    +    val key1 = 1L
    +    val value1 = new Random().nextLong()
    +
    +    val key2 = 2L
    +    val value2 = new Random().nextLong()
    +
    +    originalMap.append(key1, unsafeProj(InternalRow(value1)))
    +    originalMap.append(key2, unsafeProj(InternalRow(value2)))
    +    originalMap.optimize()
    +
    +    val resultRow = new UnsafeRow(1)
    +    assert(originalMap.getValue(key1, resultRow).getLong(0) === value1)
    +    assert(originalMap.getValue(key2, resultRow).getLong(0) === value2)
    +
    +    val ser = new KryoSerializer(
    +            (new SparkConf).set("spark.kryo.referenceTracking", "false")).newInstance()
    +
    +    val mapSerializedInDriver = ser.deserialize[LongToUnsafeRowMap](ser.serialize(originalMap))
    --- End diff --
    
    nit:
    ```scala
    // Simulate serialize/deserialize twice on driver and executor
    val firstTimeSerialized = ...
    val secondTimeSerialized = ...
    ```


---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongHashedRelation in ex...

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

    https://github.com/apache/spark/pull/21772
  
    Can one of the admins verify this patch?


---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongToUnsafeRowMap in ex...

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

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


---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongToUnsafeRowMap in ex...

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

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


---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongToUnsafeRowMap in ex...

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

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


---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongHashedRelation in ex...

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

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


---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongToUnsafeRowMap in ex...

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

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


---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongHashedRelation in ex...

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

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


---

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


[GitHub] spark pull request #21772: [SPARK-24809] [SQL] Serializing LongHashedRelatio...

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

    https://github.com/apache/spark/pull/21772#discussion_r203252809
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/joins/HashedRelation.scala ---
    @@ -726,8 +726,9 @@ private[execution] final class LongToUnsafeRowMap(val mm: TaskMemoryManager, cap
     
         writeLong(array.length)
         writeLongArray(writeBuffer, array, array.length)
    -    val used = ((cursor - Platform.LONG_ARRAY_OFFSET) / 8).toInt
    -    writeLong(used)
    +    val cursorFlag = cursor - Platform.LONG_ARRAY_OFFSET
    +    writeLong(cursorFlag)
    +    val used = (cursorFlag / 8).toInt
    --- End diff --
    
    Can you post the image in this PR? The web site you refer contains too many ads.


---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongHashedRelation in ex...

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

    https://github.com/apache/spark/pull/21772
  
    Can one of the admins verify this patch?


---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongToUnsafeRowMap in ex...

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

    https://github.com/apache/spark/pull/21772
  
    LGTM too.


---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongHashedRelation in ex...

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

    https://github.com/apache/spark/pull/21772
  
    Can one of the admins verify this patch?


---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongHashedRelation in ex...

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

    https://github.com/apache/spark/pull/21772
  
    @viirya This case  occurred in our cluster and we took a lot of time to find this bug.
    For some man-made reasons, the small table's max id has become abnormally large. The LongHasedRelation generated based on the table was not optimized to `dense` and has become abnormally big(approximately 400MB).


---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongHashedRelation in ex...

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

    https://github.com/apache/spark/pull/21772
  
    **[Test build #93473 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/93473/testReport)** for PR 21772 at commit [`06a9547`](https://github.com/apache/spark/commit/06a95472f1e889cdd21e7051fc906526f333f6d3).


---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongHashedRelation in ex...

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

    https://github.com/apache/spark/pull/21772
  
    ok to test


---

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


[GitHub] spark pull request #21772: [SPARK-24809] [SQL] Serializing LongHashedRelatio...

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

    https://github.com/apache/spark/pull/21772#discussion_r204618745
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/execution/joins/HashedRelationSuite.scala ---
    @@ -278,6 +278,39 @@ class HashedRelationSuite extends SparkFunSuite with SharedSQLContext {
         map.free()
       }
     
    +  test("SPARK-24809: Serializing LongHashedRelation in executor may result in data error") {
    +    val unsafeProj = UnsafeProjection.create(Array[DataType](LongType))
    +    val originalMap = new LongToUnsafeRowMap(mm, 1)
    +
    +    val key1 = 1L
    +    val value1 = new Random().nextLong()
    +
    +    val key2 = 2L
    +    val value2 = new Random().nextLong()
    +
    +    originalMap.append(key1, unsafeProj(InternalRow(value1)))
    +    originalMap.append(key2, unsafeProj(InternalRow(value2)))
    +    originalMap.optimize()
    +
    +    val resultRow = new UnsafeRow(1)
    +    assert(originalMap.getValue(key1, resultRow).getLong(0) === value1)
    +    assert(originalMap.getValue(key2, resultRow).getLong(0) === value2)
    --- End diff --
    
    We don't need to test `LongToUnsafeRowMap`'s normal feature here. We just need to verify the map after two ser/de can work normally.


---

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


[GitHub] spark pull request #21772: [SPARK-24809] [SQL] Serializing LongToUnsafeRowMa...

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

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


---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongHashedRelation in ex...

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

    https://github.com/apache/spark/pull/21772
  
    As you actually modify `LongToUnsafeRowMap`, is it better to update the PR title and description to reflect that?


---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongHashedRelation in ex...

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

    https://github.com/apache/spark/pull/21772
  
    Jenkins, test this please


---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongHashedRelation in ex...

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

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


---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongHashedRelation in ex...

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

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


---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongToUnsafeRowMap in ex...

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

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


---

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


[GitHub] spark pull request #21772: [SPARK-24809] [SQL] Serializing LongHashedRelatio...

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

    https://github.com/apache/spark/pull/21772#discussion_r204613880
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/execution/joins/HashedRelationSuite.scala ---
    @@ -278,6 +278,39 @@ class HashedRelationSuite extends SparkFunSuite with SharedSQLContext {
         map.free()
       }
     
    +  test("SPARK-24809: Serializing LongHashedRelation in executor may result in data error") {
    --- End diff --
    
    I think this UT can cover the case I had met.
    End-to-end test is too hard to structure because this case just occurs when executor's memory is not enough to hold the block and the broadcast cache is removed by the garbage collector.


---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongToUnsafeRowMap in ex...

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

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


---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongHashedRelation in ex...

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

    https://github.com/apache/spark/pull/21772
  
    @liutang123 Thanks for this work. I'm curious that if this is an actual problem you hit in real application, or you just think it is problematic?


---

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


[GitHub] spark pull request #21772: [SPARK-24809] [SQL] Serializing LongHashedRelatio...

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

    https://github.com/apache/spark/pull/21772#discussion_r204276788
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/joins/HashedRelation.scala ---
    @@ -726,9 +726,10 @@ private[execution] final class LongToUnsafeRowMap(val mm: TaskMemoryManager, cap
     
         writeLong(array.length)
         writeLongArray(writeBuffer, array, array.length)
    -    val used = ((cursor - Platform.LONG_ARRAY_OFFSET) / 8).toInt
    -    writeLong(used)
    -    writeLongArray(writeBuffer, page, used)
    +
    +    val usedWordsNumber = ((cursor - Platform.LONG_ARRAY_OFFSET) / 8).toInt
    +    writeLong(usedWordsNumber)
    +    writeLongArray(writeBuffer, page, usedWordsNumber)
    --- End diff --
    
    If no good reason, shall we revert this change? Looks like you only rename it?


---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongHashedRelation in ex...

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

    https://github.com/apache/spark/pull/21772
  
    Jenkins test this please


---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongHashedRelation in ex...

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

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


---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongToUnsafeRowMap in ex...

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

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


---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongToUnsafeRowMap in ex...

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

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


---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongHashedRelation in ex...

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

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


---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongToUnsafeRowMap in ex...

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

    https://github.com/apache/spark/pull/21772
  
    retest this please


---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongHashedRelation in ex...

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

    https://github.com/apache/spark/pull/21772
  
    @liutang123 can you explain why we are losing data when serializing to disk. Also can you add a unit test?


---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongToUnsafeRowMap in ex...

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

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


---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongHashedRelation in ex...

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

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


---

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


[GitHub] spark pull request #21772: [SPARK-24809] [SQL] Serializing LongHashedRelatio...

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

    https://github.com/apache/spark/pull/21772#discussion_r204276886
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/joins/HashedRelation.scala ---
    @@ -770,8 +771,10 @@ private[execution] final class LongToUnsafeRowMap(val mm: TaskMemoryManager, cap
         val length = readLong().toInt
         mask = length - 2
         array = readLongArray(readBuffer, length)
    -    val pageLength = readLong().toInt
    -    page = readLongArray(readBuffer, pageLength)
    +    val usedWordsNumber = readLong().toInt
    +    // Set cursor because cursor is used in write function.
    +    cursor = usedWordsNumber * 8 + Platform.LONG_ARRAY_OFFSET
    +    page = readLongArray(readBuffer, usedWordsNumber)
    --- End diff --
    
    ditto. Can you just update `cursor` and revert other unrelated change?


---

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


[GitHub] spark pull request #21772: [SPARK-24809] [SQL] Serializing LongHashedRelatio...

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

    https://github.com/apache/spark/pull/21772#discussion_r203365167
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/joins/HashedRelation.scala ---
    @@ -726,8 +726,9 @@ private[execution] final class LongToUnsafeRowMap(val mm: TaskMemoryManager, cap
     
         writeLong(array.length)
         writeLongArray(writeBuffer, array, array.length)
    -    val used = ((cursor - Platform.LONG_ARRAY_OFFSET) / 8).toInt
    -    writeLong(used)
    +    val cursorFlag = cursor - Platform.LONG_ARRAY_OFFSET
    +    writeLong(cursorFlag)
    +    val used = (cursorFlag / 8).toInt
    --- End diff --
    
    ![image](https://issues.apache.org/jira/secure/attachment/12932027/Spark%20LongHashedRelation%20serialization.svg)



---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongHashedRelation in ex...

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

    https://github.com/apache/spark/pull/21772
  
    @viirya Yes, absolutely right. :)


---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongHashedRelation in ex...

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

    https://github.com/apache/spark/pull/21772
  
    **[Test build #93267 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/93267/testReport)** for PR 21772 at commit [`f67ff4d`](https://github.com/apache/spark/commit/f67ff4d91764e67f811ebfb7c02ab466153a5b02).
     * This patch **fails Spark unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongHashedRelation in ex...

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

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


---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongToUnsafeRowMap in ex...

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

    https://github.com/apache/spark/pull/21772
  
    good catch! LGTM


---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongHashedRelation in ex...

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

    https://github.com/apache/spark/pull/21772
  
    Let me clarify it. So this means that when `LongToUnsafeRowMap` is broadcasted to executors, and it is too big to hold in memory, it will be stored in disk. At that time, because `write` uses `cursor` to determine `used`, it will write out nothing from `page` into disk.
    
    Is this what you mean?  



---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongToUnsafeRowMap in ex...

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

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


---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongHashedRelation in ex...

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

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


---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongToUnsafeRowMap in ex...

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

    https://github.com/apache/spark/pull/21772
  
    **[Test build #93749 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/93749/testReport)** for PR 21772 at commit [`6246dfa`](https://github.com/apache/spark/commit/6246dfaff1bd04820f9b71cae60f663b45515d7a).


---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongToUnsafeRowMap in ex...

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

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


---

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


[GitHub] spark issue #21772: [SPARK-24809] [SQL] Serializing LongToUnsafeRowMap in ex...

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

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


---

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


[GitHub] spark pull request #21772: [SPARK-24809] [SQL] Serializing LongHashedRelatio...

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

    https://github.com/apache/spark/pull/21772#discussion_r203241485
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/joins/HashedRelation.scala ---
    @@ -726,8 +726,9 @@ private[execution] final class LongToUnsafeRowMap(val mm: TaskMemoryManager, cap
     
         writeLong(array.length)
         writeLongArray(writeBuffer, array, array.length)
    -    val used = ((cursor - Platform.LONG_ARRAY_OFFSET) / 8).toInt
    -    writeLong(used)
    +    val cursorFlag = cursor - Platform.LONG_ARRAY_OFFSET
    +    writeLong(cursorFlag)
    +    val used = (cursorFlag / 8).toInt
    --- End diff --
    
    losing data when serializing LongHashedRelation in executor, can you see [this picture](http://oi67.tinypic.com/2z5pzs7.jpg)? In executor, the cursor is 0.


---

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


[GitHub] spark pull request #21772: [SPARK-24809] [SQL] Serializing LongHashedRelatio...

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

    https://github.com/apache/spark/pull/21772#discussion_r203204659
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/joins/HashedRelation.scala ---
    @@ -726,8 +726,9 @@ private[execution] final class LongToUnsafeRowMap(val mm: TaskMemoryManager, cap
     
         writeLong(array.length)
         writeLongArray(writeBuffer, array, array.length)
    -    val used = ((cursor - Platform.LONG_ARRAY_OFFSET) / 8).toInt
    -    writeLong(used)
    +    val cursorFlag = cursor - Platform.LONG_ARRAY_OFFSET
    +    writeLong(cursorFlag)
    +    val used = (cursorFlag / 8).toInt
    --- End diff --
    
    Is this said, that when `(cursor - Platform.LONG_ARRAY_OFFSET) / 8` is over the range of Int, we will have overflow? But later you still do `toInt` and use the value?


---

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


[GitHub] spark pull request #21772: [SPARK-24809] [SQL] Serializing LongHashedRelatio...

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

    https://github.com/apache/spark/pull/21772#discussion_r204276973
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/execution/joins/HashedRelationSuite.scala ---
    @@ -278,6 +278,39 @@ class HashedRelationSuite extends SparkFunSuite with SharedSQLContext {
         map.free()
       }
     
    +  test("SPARK-24809: Serializing LongHashedRelation in executor may result in data error") {
    --- End diff --
    
    Is it possible to have an end-to-end test for this?


---

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