avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John McClean <jmccl...@gmail.com>
Subject Re: Customizing JSON encoding for Avro C++ bindings
Date Tue, 07 Mar 2017 15:44:51 GMT
If you want a string representation, can you use 'string' as the type
rather than 'fixed'? Or is the issue that you have data conversion /
backwards compatibility constraints?

On Tue, Mar 7, 2017 at 6:51 AM, Tim Upthegrove <tim.upthegrove@gmail.com>

> Hi folks,
> I am trying to add a convenience method for my team that can serialize an
> Avro record in the C++ bindings to JSON with a few minor customizations.
> For example, our schema encodes UUIDs as Fixed types, and they are the only
> fields which are a Fixed type with the particular length of a UUID.  We'd
> like to encode those UUIDs in the JSON output according to the RFC 4122
> specified UUID format instead of a unicode escape sequence for ease of
> debugging.
> Since we only have a few minor changes, I initially thought it would make
> sense to use inheritence for this, but looking at the JsonGenerator and
> JsonEncoder classes that currently exist, this seems like it could be
> challenging.  Continuing with the UUID example, the specific method I'd
> want to override (escapeCtl at https://github.com/apache/
> avro/blob/master/lang/c++/impl/json/JsonIO.hh#L214) and the StreamWriter
> for building the JSON string are both private to the JsonGenerator class.
> Is there an easy way to achieve what I describe in the example above in
> the C++ bindings that I am missing or overlooking?  If not, is there any
> reason why those methods should not be changed from private visibility to
> protected so I could accomplish this through inheritence?
> Thanks,
> --
> Tim Upthegrove

View raw message