Grokbase Groups Avro user May 2013
FAQ
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

Search Discussions

  • Tim Goodman at May 30, 2013 at 1:01 pm
    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: 'user@avro.apache.org'
    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
  • Doug Cutting at May 30, 2013 at 4:36 pm
    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 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: 'user@avro.apache.org'
    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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriesavro
postedMay 28, '13 at 2:42p
activeMay 30, '13 at 4:36p
posts3
users2
websiteavro.apache.org
irc#avro

2 users in discussion

Tim Goodman: 2 posts Doug Cutting: 1 post

People

Translate

site design / logo © 2021 Grokbase