Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Support Questions

Find answers, ask questions, and share your expertise
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!

AVRO timestamp parsing in Nifi

avatar
Explorer

Hitting a weird issue in Nifi that I can't get my head around.

I am consuming AVRO records from Kafka with a timestamp field. The definition is

    {
      "name" : "timestamp",
      "type" : {
        "type" : "long",
        "logicalType" : "timestamp-millis"
      }
    },

If I use a JSON record writer then in the queue viewer I can see the field contains the original long value. However if I use an AVRO writer the field is formatted as a date/time value, e.g. 2025-09-26T15:29:44.466Z.

I assumed this was just pretty-printing in the queue viewer. But if I then send those flowfiles to a ConvertRecord process with an AVRO reader and a FreeText writer the timestamp field is now displayed as YYYY-mm-DD HH:MM:SS. Which means I've lost precision and I need to use expression language to re-parse the field to convert it back to a long value.

So, I'm forced to us JSON as the intermediary format. If I use AVRO I loose precision.

This is Nifi 2.5.

1 REPLY 1

avatar
Explorer

Reading back my post I didn't explain it very well.

When I output a timestamp field using a FreeFormTextRecordSetWriter the field is implicitly converted to a string of format YYYY-mm-DD HH:MM:SS. I cannot see any way to change this behaviour and all my searches turn up blank. What I want is the Writer to respect the original long value.