title: Different behavior of Spark Dataset for java.util.UUID
body: <p>I am using Spark 2.0.0 and creating a <code>Dataset</code> using <code>SparkSession</code>. When I use <code>java.util.UUID</code> in <code>createDataFrame</code> method it works fine. But when I have <code>java.util.UUID</code> as a field in Javabean and when I use this Javabean to create Dataset, it gives me <code>scala.MatchError</code>. Please see the code and console log below. Can any one tell me what is going on here and how can I create <code>Dataset</code> with <code>UUID</code> in Javabean class. Thanks.</p>
  
  <p><strong>UUIDTest.java</strong></p>
  
  <pre><code>public class UUIDTest { 
    public static void main(String[] args) {
       SparkSession spark = SparkSession
                .builder()
                .appName("UUIDTest")
                .config("spark.sql.warehouse.dir", "/file:C:/temp")
                .master("local[2]")
                .getOrCreate();
  
       System.out.println("====&gt; Create Dataset using UUID"); 
  
       //Working
       List&lt;UUID&gt; uuids = Arrays.asList(UUID.randomUUID(),UUID.randomUUID());      
       Dataset&lt;Row&gt; uuidSet = spark.createDataFrame(uuids, UUID.class);        
       uuidSet.show();
  
       System.out.println("====&gt; Create Dataset using UserUUID"); 
  
       //Not Working
       List&lt;UserUUID&gt; userUuids = Arrays.asList(new UserUUID(UUID.randomUUID()),new UserUUID(UUID.randomUUID()));
       Dataset&lt;Row&gt; userUuidSet = spark.createDataFrame(userUuids, UserUUID.class);//Exception at this line        
       userUuidSet.show();    
  
       spark.stop();
     }
  }
  </code></pre>
  
  <p><strong>UserUUID.java</strong></p>
  
  <pre><code>public class UserUUID implements Serializable{
  
  private UUID uuid;
  
  public UserUUID() {
  }
  
  public UserUUID(UUID uuid) {
      this.uuid = uuid;
  }
  
  public UUID getUuid() {
      return uuid;
  }
  
  public void setUuid(UUID uuid) {
      this.uuid = uuid;
    }
  }
  </code></pre>
  
  <p><strong>Console output</strong></p>
  
  <pre><code>16/08/26 22:49:23 INFO SharedState: Warehouse path is '/file:C:/temp'.
  ====&gt; Create Dataset using UUID
  16/08/26 22:49:26 INFO CodeGenerator: Code generated in 248.230818 ms
  16/08/26 22:49:26 INFO CodeGenerator: Code generated in 10.550477 ms
  +--------------------+-------------------+
  |leastSignificantBits|mostSignificantBits|
  +--------------------+-------------------+
  |-6786538026241948655|5045373365275148508|
  |-9161219066266259673|6040751881536491488|
  +--------------------+-------------------+
  
  ====&gt; Create Dataset using UserUUID
  Exception in thread "main" scala.MatchError: 4fa3941c-f312-4031-a61b-01f2acef751b (of class java.util.UUID)
  at org.apache.spark.sql.catalyst.CatalystTypeConverters$StructConverter.toCatalystImpl(CatalystTypeConverters.scala:256)
  at org.apache.spark.sql.catalyst.CatalystTypeConverters$StructConverter.toCatalystImpl(CatalystTypeConverters.scala:251)
  at org.apache.spark.sql.catalyst.CatalystTypeConverters$CatalystTypeConverter.toCatalyst(CatalystTypeConverters.scala:103)
  at org.apache.spark.sql.catalyst.CatalystTypeConverters$$anonfun$createToCatalystConverter$2.apply(CatalystTypeConverters.scala:403)
  at org.apache.spark.sql.SQLContext$$anonfun$beansToRows$1$$anonfun$apply$1.apply(SQLContext.scala:1106)
  at org.apache.spark.sql.SQLContext$$anonfun$beansToRows$1$$anonfun$apply$1.apply(SQLContext.scala:1106)
  at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)
  at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)
  at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
  at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:186)
  at scala.collection.TraversableLike$class.map(TraversableLike.scala:234)
  at scala.collection.mutable.ArrayOps$ofRef.map(ArrayOps.scala:186)
  at org.apache.spark.sql.SQLContext$$anonfun$beansToRows$1.apply(SQLContext.scala:1106)
  at org.apache.spark.sql.SQLContext$$anonfun$beansToRows$1.apply(SQLContext.scala:1104)
  at scala.collection.Iterator$$anon$11.next(Iterator.scala:409)
  at scala.collection.Iterator$class.toStream(Iterator.scala:1322)
  at scala.collection.AbstractIterator.toStream(Iterator.scala:1336)
  at scala.collection.TraversableOnce$class.toSeq(TraversableOnce.scala:298)
  at scala.collection.AbstractIterator.toSeq(Iterator.scala:1336)
  at org.apache.spark.sql.SparkSession.createDataFrame(SparkSession.scala:373)
  at com.UUIDTest.main(UUIDTest.java:30)
  16/08/26 22:49:26 INFO SparkContext: Invoking stop() from shutdown hook
  </code></pre>