title: SparkSQL not supporting java.util.Date
body: <p>Saw <a href="https://stackoverflow.com/questions/25419412/sparksql-not-supporting-date-format">this post</a>, which implies it is fixed in spark 1.2.0. The <a href="https://issues.apache.org/jira/browse/SPARK-2562" rel="nofollow noreferrer">bug</a> however talks about java.sql.Date.</p>
  
  <p>Anyway, it is not working for me, I get: </p>
  
  <pre><code>Exception in thread "main" scala.MatchError: class java.util.Date (of class java.lang.Class)
  </code></pre>
  
  <p>Here's a code example:</p>
  
  <pre><code>public class DateSparkSQLExample {
  
  public static void main(String[] args) {
      SparkConf conf = new SparkConf().setAppName("test").setMaster("local");
      JavaSparkContext sc = new JavaSparkContext(conf);
  
      List&lt;SomeObject&gt; itemsList = Lists.newArrayListWithCapacity(1);
      itemsList.add(new SomeObject(new Date(), 1L));
      JavaRDD&lt;SomeObject&gt; someObjectJavaRDD = sc.parallelize(itemsList);
  
      JavaSQLContext sqlContext = new org.apache.spark.sql.api.java.JavaSQLContext(sc);
      sqlContext.applySchema(someObjectJavaRDD, SomeObject.class).registerTempTable("temp_table");
  }
  
  private static class SomeObject implements Serializable{
      private Date timestamp;
      private Long value;
  
      public SomeObject() {
      }
  
      public SomeObject(Date timestamp, Long value) {
          this.timestamp = timestamp;
          this.value = value;
      }
  
      public Date getTimestamp() {
          return timestamp;
      }
  
      public void setTimestamp(Date timestamp) {
          this.timestamp = timestamp;
      }
  
      public Long getValue() {
          return value;
      }
  
      public void setValue(Long value) {
          this.value = value;
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Thanks, 
  Lior</p>
  
  <p><strong>EDIT 1:</strong></p>
  
  <p>Maybe I rushed into posting this, because SparkSQL clearly states that the type for Date is java.sql.Date.
  However, I would like to use the same bean for RDDs loaded from Cassandra and than registered to SparkSQL. Since in my C* model the data type is timestamp (which is mapped to java.util.Date), I can't really do it. 
  As I see it, the only option to use the same model is change the C* type from timestamp to bigint, and it's a bummer.
  Any ideas on how I can bridge this?</p>