title: Require kryo serialization in Spark (Scala)
body: <p>I have kryo serialization turned on with this:</p>
  
  <pre><code>conf.set( "spark.serializer", "org.apache.spark.serializer.KryoSerializer" )
  </code></pre>
  
  <p>I want to ensure that a custom class is serialized using kryo when shuffled between nodes. I can register the class with kryo this way:</p>
  
  <pre><code>conf.registerKryoClasses(Array(classOf[Foo]))
  </code></pre>
  
  <p>As I understand it, this does not actually guarantee that kyro serialization is used; if a serializer is not available, kryo will fall back to Java serialization.</p>
  
  <p>To guarantee that kryo serialization happens, I followed this recommendation from the Spark documentation:</p>
  
  <pre><code>conf.set("spark.kryo.registrationRequired", "true")
  </code></pre>
  
  <p>But this causes IllegalArugmentException to be thrown ("Class is not registered") for a bunch of different classes which I assume Spark uses internally, for example the following:</p>
  
  <pre><code>org.apache.spark.util.collection.CompactBuffer
  scala.Tuple3
  </code></pre>
  
  <p>Surely I do not have to manually register each of these individual classes with kryo? These serializers are all defined in kryo, so is there a way to automatically register all of them?</p>