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

Switch to Threaded View
Avro, mail # dev - Forward Declaration


Copy link to this message
-
Re: Forward Declaration
Scott Carey 2013-06-28, 16:14
I apologize, my spell correct renamed "fivebytes" to "five bytes"
everywhere below, spaces aren't permitted in Avro names.

On 6/28/13 9:08 AM, "Scott Carey" <[EMAIL PROTECTED]> wrote:

>I assume he means the difference between:
>
>{"type":"record", "name":"ForwardRef", "fields":[
>  {"name":"thing_ref", "type": "five bytes"},
>  {"name":"thing_declared", "type": {"type":"fixed", "size":5,
>"name":"five bytes"}}
>]}
>
>{"type":"record", "name":"BackRef", "fields":[
>  {"name":"thing_declared", "type": {"type":"fixed", "size":5,
>"name":"five bytes"}}
>  {"name":"thing_ref", "type": "five bytes"},
>]}
>
>The Avro spec does not currently support the first of the above,
>references must be declared before being used.
>
>
>We could change this, but every language implementation would need to be
>updated, and it could create some compatibility issues (old code would not
>necessarily parse new schemas).
>New features for avro schemas since the start have almost entirely been
>forwards-compatible.  The rare exceptions have been when bug fixes or
>language differences necessitated otherwise.
>
>At the moment, most of the schema parsers eagerly decode named references
>rather than being lazy.
>
>On 6/24/13 10:19 AM, "Thiruvalluvan MG" <[EMAIL PROTECTED]> wrote:
>
>>Hi Thomas Dressel,
>>
>>Is it possible to elaborate on what you mean by "forward declaration"?
>>I'm aware of one usage of the term in C and C++ where instead of exposing
>>the full definition of a function, data or class you expose just its
>>declaration and then supply the full definition later. Here is an example
>>with class declaration:
>>
>>class X;
>>
>>class Y {
>>public:
>>    X* x;
>>};
>>
>>class X {
>>public:
>>    Y *y;
>>};
>>
>>This is the only way to handle circular references between classes X and
>>Y. But I don't understand its reference to Avro.
>>
>>Still better, can you give a small example of what you are trying to do?
>>
>>Thank you,
>>
>>Thiru
>>
>>________________________________
>> From: Thomas Dressel <[EMAIL PROTECTED]>
>>To: [EMAIL PROTECTED]
>>Sent: Monday, 24 June 2013 7:10 PM
>>Subject: Forward Declaration
>>
>>
>>Hello,
>>
>>I've searched the web and the Documentation of Avro, but I didn't get
>>an answer.
>>So I write this email to you, with the question, if Avro does support
>>forward declaration?
>>
>>I look forward to hearing from you soon.
>>
>>
>>Yours faithfully,
>>
>>Thomas Dressel
>
>