You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@nifi.apache.org by Matt Burgess <ma...@gmail.com> on 2017/10/19 17:14:07 UTC

Re: Avro timestamp problem

Uwe,

I think you are running into either AVRO-2065 [1] or its related issue
AVRO-1891 [2].  Hopefully they will fix it for 1.8.3 and we can
upgrade after it is released. In the meantime, try a schema with just
a union between null and long, then use QueryRecord to filter out all
the records whose value of AAN is null. Then a ConvertRecord should be
able to convert the records with non-null AAN values into a timestamp
type.  You could also send the null records to UpdateRecord which
could fill in a default value, then send those back to the main flow.

Regards,
Matt

[1] https://issues.apache.org/jira/browse/AVRO-2065
[2] https://issues.apache.org/jira/browse/AVRO-1891

On Thu, Oct 19, 2017 at 1:00 PM, Uwe Geercken <uw...@web.de> wrote:
> Hello,
>
> I have a problem with a timestamp field and the avro schema. the field is
> defined as:
>
>     {"name": "AAN", "type": [{"type": "long","logicalType":
> "timestamp-millis"},"null"]},
>
>
> The Avro specs say:
>
> "A timestamp-millis logical type annotates an Avro long, where the long
> stores the number of milliseconds from the unix epoch, 1 January 1970
> 00:00:00.000 UTC. "
>
>
> Now when a value of type long is used, I get following exception:
>
> java.lang.ClassCastException: java.lang.Long cannot be cast to
> org.joda.time.DateTime
>
> Can anybody help?
>
> Rgds,
>
> Uwe