Skip to content

Commit

Permalink
2.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan-williams committed Oct 10, 2017
1 parent 1dc959b commit f4a9119
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 22 deletions.
4 changes: 2 additions & 2 deletions build.sbt
@@ -1,12 +1,12 @@
name := "spark-tests"

version := "2.3.0-SNAPSHOT"
version := "2.3.0"

deps ++= Seq(
paths % "1.3.1",
scalatest,
spark,
spark_util % "2.0.0-SNAPSHOT",
spark_util % "2.0.0",
testUtils
)

Expand Down
2 changes: 1 addition & 1 deletion project/plugins.sbt
@@ -1 +1 @@
addSbtPlugin("org.hammerlab" % "sbt-parent" % "3.1.1")
addSbtPlugin("org.hammerlab" % "sbt-parent" % "3.3.0")
@@ -1,8 +1,6 @@
package org.hammerlab.spark.test.suite

import org.apache.spark.serializer.KryoRegistrator
import org.hammerlab.kryo.spark.Registrator
import org.hammerlab.spark.confs
import org.hammerlab.spark.SelfRegistrar

/**
* Base for test-suites that rely on Kryo serialization, including registering classes for serialization in a
Expand All @@ -11,7 +9,4 @@ import org.hammerlab.spark.confs
class KryoSparkSuite(override val registrationRequired: Boolean = true,
override val referenceTracking: Boolean = false)
extends SparkSuite
with Registrator
with confs.Kryo {
override def registrar: Class[_ <: KryoRegistrator] = getClass
}
with SelfRegistrar
Expand Up @@ -2,7 +2,6 @@ package org.hammerlab.spark.test.suite

import java.lang.System.{ clearProperty, getProperty, setProperty }

import org.apache.spark.serializer.KryoRegistrator
import org.hammerlab.spark.{ SparkConfBase, confs }
import org.hammerlab.test.Suite

Expand All @@ -14,7 +13,7 @@ import scala.collection.mutable
*
* Sets Spark configuration settings, including Kryo-serde with required registration, through system properties.
*/
class MainSuite(override val registrar: Class[_ <: KryoRegistrator] = null)
class MainSuite
extends Suite
with SparkConfBase
with TestConfs
Expand Down
Expand Up @@ -5,7 +5,7 @@ import org.hammerlab.test.Suite
/**
* Base for test suites that shar one [[org.apache.spark.SparkContext]] across all test cases.
*/
trait SparkSuite
abstract class SparkSuite
extends Suite
with SparkSuiteBase {

Expand Down
Expand Up @@ -3,6 +3,7 @@ package org.hammerlab.spark.test.suite
import com.esotericsoftware.kryo.io.{ Input, Output }
import com.esotericsoftware.kryo.{ Kryo, Serializer }
import org.apache.spark.SparkException
import org.hammerlab.kryo._

import scala.collection.mutable

Expand All @@ -11,10 +12,9 @@ class KryoSparkSuiteTest
with SparkSerialization {

register(
classOf[mutable.WrappedArray.ofRef[_]],
classOf[Foo] new FooSerializer,
classOf[Array[Foo]],
classOf[Bar]
cls[mutable.WrappedArray.ofRef[_]],
arr[Foo],
cls[Bar]
)

test("spark job custom serializer") {
Expand All @@ -35,11 +35,14 @@ class KryoSparkSuiteTest

case class Foo(n: Int, s: String)

case class FooException() extends Exception

class FooSerializer extends Serializer[Foo] {
override def write(kryo: Kryo, output: Output, `object`: Foo): Unit = throw FooException()
override def read(kryo: Kryo, input: Input, `type`: Class[Foo]): Foo = ???
object Foo {
implicit val serializer: Serializer[Foo] =
new Serializer[Foo] {
override def write(kryo: Kryo, out: Output, foo: Foo): Unit = throw FooException()
override def read(kryo: Kryo, in: Input, cls: Class[Foo]): Foo = ???
}
}

case class FooException() extends Exception

case class Bar(n: Int, s: String)

0 comments on commit f4a9119

Please sign in to comment.