title: Kafka AVRO - conversion from long to datetime
body: <p>I get the following error when I want to send an AVRO message which contains a field that has the type long:</p>
  
  <pre><code>Caused by: org.apache.kafka.common.errors.SerializationException: Error deserializing Avro message for id 61
  Caused by: java.lang.ClassCastException: java.lang.Long cannot be cast to org.joda.time.DateTime
  </code></pre>
  
  <p>I use Confluent 3.2.0 and Apache Spark 2.2.0. This error is thrown in a Spark Job which processes AVRO messages and prints them in a console. In the AVRO schema, the corresponding field is defined like this:</p>
  
  <pre><code>{\"name\": \"event_time\", \"type\": { \"type\" : \"long\", \"logicalType\": \"timestamp-millis\"}}
  </code></pre>
  
  <p>In the Java class generated from the <code>.avsc</code> file, the field is defined as below:</p>
  
  <pre><code>private DateTime event_time;
  </code></pre>