Convert Avro GenericRecord to SpecificData object while converting Long to Instant


I have a question that is explained also in this SO thread:

I have an Avro schema with a logicaltype timestamp-millis:

When I try to convert the GenericRecord to the associated schema throws an error that cannot convert Long to Instant:

Anyone has find a good solution to solve this problem?



Not really. I tried using the decimal logical type about 5 years ago. But it took a lot of effort to get it properly working + you could not easily get the value. In this case it probably a lot easier to just use the long primitive.