Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Avro, mail # user - Avro serialization in C# - how to include schema


Copy link to this message
-
Re: Avro serialization in C# - how to include schema
Doug Cutting 2013-05-30, 16:36
The encoder/decoder API is lower-level, used to implement both RPC and
data files, not used directly by most applications.

Data files should be supported in C# in Avro 1.7.5, due out soon.

https://issues.apache.org/jira/browse/AVRO-823

Doug

On Thu, May 30, 2013 at 6:00 AM, Tim Goodman <[EMAIL PROTECTED]> wrote:
> I guess I’ll answer my own question.  It doesn’t appear that the
> GenericWriter actually writes the schema.  So I suppose my best option is to
> just write it myself before writing the record:
>
> encoder.WriteString(schema.ToString());
>
> and then read it off before reading the record:
>
> var writeSchema = Schema.Parse(decoder.ReadString());
>
>
>
> I guess the schema is only normally included with the data for actual Avro
> data files (not yet supported in C#).
>
>
>
> - Tim
>
>
>
> From: Tim Goodman
> Sent: Tuesday, May 28, 2013 10:41 AM
> To: '[EMAIL PROTECTED]'
> Subject: Avro serialization in C# - how to include schema
>
>
>
> I’m trying to use Avro serialization in C#.  My understanding is that
> normally with Avro the schema is written with the data.
>
>
>
> But the constructor for GenericReader<T> requires both a writer schema and a
> reader schema.  Is there a way to extract the writer schema from the data?
> (In my case I wrote it with GenericWriter<T> and the BinaryEncoder).
>
>
>
> - Tim Goodman
>
>