spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andrewor14 <...@git.apache.org>
Subject [GitHub] spark pull request: [SPARK-10914] UnsafeRow serialization breaks w...
Date Thu, 08 Oct 2015 18:54:01 GMT
Github user andrewor14 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9030#discussion_r41553096
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/UnsafeRowSuite.scala ---
    @@ -29,6 +30,32 @@ import org.apache.spark.unsafe.types.UTF8String
     
     class UnsafeRowSuite extends SparkFunSuite {
     
    +  test("UnsafeRow Java serialization") {
    +    // serializing an UnsafeRow pointing to a large buffer should only serialize the
relevant data
    +    val data = new Array[Byte](1024)
    +    val row = new UnsafeRow
    +    row.pointTo(data, 1, 16)
    +    row.setLong(0, 19285)
    +
    +    val ser = new JavaSerializer(new SparkConf).newInstance()
    +    val row1 = ser.deserialize[UnsafeRow](ser.serialize(row))
    +    assert(row1.getLong(0) == 19285)
    +    assert(row1.getBaseObject().asInstanceOf[Array[Byte]].length == 16)
    +  }
    +
    +  test("UnsafeRow Kryo serialization") {
    +    // serializing an UnsafeRow pointing to a large buffer should only serialize the
relevant data
    +    val data = new Array[Byte](1024)
    +    val row = new UnsafeRow
    +    row.pointTo(data, 1, 16)
    +    row.setLong(0, 19285)
    +
    +    val ser = new KryoSerializer(new SparkConf).newInstance()
    +    val row1 = ser.deserialize[UnsafeRow](ser.serialize(row))
    +    assert(row1.getLong(0) == 19285)
    +    assert(row1.getBaseObject().asInstanceOf[Array[Byte]].length == 16)
    --- End diff --
    
    `===`


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


Mime
View raw message