Hi Mike,

This JSON doesn't seems like a valid Avro schema
<https://avro.apache.org/docs/1.8.1/spec.html#schemas>. If you'd like to
use timestamps in your schema, you should use Timestamp logical types,
<https://avro.apache.org/docs/1.8.1/spec.html#Timestamp+%28millisecond+precision%29>
which annotate Avro longs. In this case the schema of this field should
look like this:

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

If you'd like to create Avro files with this schema, there's on Avro wiki
you can find a brief tutorial
<https://avro.apache.org/docs/1.8.1/gettingstartedjava.html#Compiling+the+schema>
how to create and write Avro files with this schema in Java.

Regards,
Nandor

On Tue, Oct 24, 2017 at 8:18 PM, Mike Thomsen <[email protected]>
wrote:

> I am trying to build an avro schema for a NiFi flow that is going to
> insert data into Mongo, and Mongo extended JSON requires the use of $
> characters in cases like this (to represent a date):
>
> {
>     "timestamp": {
>         "$date": TIMESTAMP_LONG_HERE
>     }
> }
>
> I tried building a schema with that, and it failed saying there was an
> invalid character in the schema.  just wanted to check and see if there was
> a work around for this or if I'll have to choose another option.
>
> Thanks,
>
> Mike
>

Reply via email to