title: How to use java.time.LocalDate in Datasets (fails with java.lang.UnsupportedOperationException: No Encoder found)?
body: <ul>
  <li>Spark 2.1.1</li>
  <li>Scala 2.11.8</li>
  <li>Java 8</li>
  <li>Linux Ubuntu 16.04 LTS</li>
  </ul>
  
  <p>I'd like to transform my RDD into a Dataset. For this, I use the <code>implicits</code> method <code>toDS()</code> that give me the following error:</p>
  
  <pre><code>Exception in thread "main" java.lang.UnsupportedOperationException: No Encoder found for java.time.LocalDate
  - field (class: "java.time.LocalDate", name: "date")
  - root class: "observatory.TemperatureRow"
      at org.apache.spark.sql.catalyst.ScalaReflection$.org$apache$spark$sql$catalyst$ScalaReflection$$serializerFor(ScalaReflection.scala:602)
      at org.apache.spark.sql.catalyst.ScalaReflection$$anonfun$9.apply(ScalaReflection.scala:596)
      at org.apache.spark.sql.catalyst.ScalaReflection$$anonfun$9.apply(ScalaReflection.scala:587)
      at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:241)
      at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:241)
      at scala.collection.immutable.List.foreach(List.scala:381)
      at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:241)
      at scala.collection.immutable.List.flatMap(List.scala:344)
  </code></pre>
  
  <p>In my case, I must use the type <code>java.time.LocalDate</code>, I can't use the <code>java.sql.data</code>. I have read that I need to informe Spark how transforme Java type into Sql type, I this direction, I build the 2 implicits functions below:</p>
  
  <pre><code>implicit def toSerialized(t: TemperatureRow): EncodedTemperatureRow = EncodedTemperatureRow(t.date.toString, t.location, t.temperature)
  implicit def fromSerialized(t: EncodedTemperatureRow): TemperatureRow = TemperatureRow(LocalDate.parse(t.date), t.location, t.temperature)
  </code></pre>
  
  <hr>
  
  <p>Below, some code about my application: </p>
  
  <pre><code>case class Location(lat: Double, lon: Double)
  
  case class TemperatureRow(
                               date: LocalDate,
                               location: Location,
                               temperature: Double
                           )
  
  case class EncodedTemperatureRow(
                               date: String,
                               location: Location,
                               temperature: Double
  
  val s = Seq[TemperatureRow](
                      TemperatureRow(LocalDate.parse("2017-01-01"), Location(1.4,5.1), 4.9),
                      TemperatureRow(LocalDate.parse("2014-04-05"), Location(1.5,2.5), 5.5)
                  )
  
  import spark.implicits._
  val temps: RDD[TemperatureRow] = sc.parallelize(s)
  val tempsDS = temps.toDS
  </code></pre>
  
  <p>I don't know why Spark search an encoder for <code>java.time.LocalDate</code>, I provide implicit conversions for <code>TemperatureRow</code> and <code>EncodedTemperatureRow</code>...</p>