You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@avro.apache.org by Shaun Williams <sh...@gmail.com> on 2011/10/12 20:37:01 UTC

C++/Java schema compatibility

I'm trying to compile the Mail.avpr schema from the avro-rpc-quickstart
example using the c++ tools, and precompile fails with the following error:
"Failed to parse or compile schema: Schema is invalid, due to bad node of
type symbolic."

I even tried generating the avpr from an avdl, but precompile still fails
with the same error.  Any idea what the problem might be?

Here's my avdl FYI:

@namespace("example.proto")
protocol Mail{
record Message {
string to;
string from;
string body;
}

string send(Message message);
}

Thanks!

Re: C++/Java schema compatibility

Posted by Matt Stevenson <ma...@gmail.com>.
Yes, Java has full support and C++ does not.

I do not know of a way to use an .avpr in C++.If it doesn't already exist,
you could make a script to pull out records and namespaces from an .avpr and
then generate.

imho, adding full protocol/RPC support from a schema is a bigger priority
than code gen.

On Wed, Oct 12, 2011 at 4:48 PM, Shaun Williams <sh...@gmail.com>wrote:

> So is there richer schema support for java than c++?  I am trying to use
> avro RPC as the protocol between a java client and a c++ server.  I was
> hoping that I could define the schemas once and generate code for both
> platforms.  Is that not possible at the moment?
>
> Thanks!
>
> Shaun
>
>
> On Wed, Oct 12, 2011 at 2:30 PM, Matt Stevenson <
> matt.r.stevenson@gmail.com> wrote:
>
>> Sorry, I wasn't paying attention and thought the Java class was json.
>>
>> Save this as a .json:
>>
>>> {
>>>     "name": "Message", "type": "record",
>>>     "fields": [
>>>         {"name": "to", "type": "string"},
>>>         {"name": "from", "type": "string"},
>>>         {"name": "body", "type": "string"}
>>>     ]
>>> }
>>>
>>
>>
>> On Wed, Oct 12, 2011 at 4:27 PM, Matt Stevenson <
>> matt.r.stevenson@gmail.com> wrote:
>>
>>> The avrogencpp tool will only parse individual records.
>>> If you save
>>>
>>> record Message {
>>>  string to;
>>>  string from;
>>> string body;
>>> }
>>>
>>> as a .json file, it will generate the class.
>>> I think only records are supported in C++ and not full protocols.
>>>
>>>
>>> On Wed, Oct 12, 2011 at 1:37 PM, Shaun Williams <sh...@gmail.com>wrote:
>>>
>>>> I'm trying to compile the Mail.avpr schema from the avro-rpc-quickstart
>>>> example using the c++ tools, and precompile fails with the following error:
>>>> "Failed to parse or compile schema: Schema is invalid, due to bad node
>>>> of type symbolic."
>>>>
>>>> I even tried generating the avpr from an avdl, but precompile still
>>>> fails with the same error.  Any idea what the problem might be?
>>>>
>>>> Here's my avdl FYI:
>>>>
>>>> @namespace("example.proto")
>>>> protocol Mail{
>>>> record Message {
>>>> string to;
>>>>  string from;
>>>> string body;
>>>> }
>>>>
>>>> string send(Message message);
>>>> }
>>>>
>>>> Thanks!
>>>>
>>>
>>>
>>>
>>> --
>>> Matt Stevenson.
>>>
>>
>>
>>
>> --
>> Matt Stevenson.
>>
>
>


-- 
Matt Stevenson.

Re: C++/Java schema compatibility

Posted by Shaun Williams <sh...@gmail.com>.
So is there richer schema support for java than c++?  I am trying to use
avro RPC as the protocol between a java client and a c++ server.  I was
hoping that I could define the schemas once and generate code for both
platforms.  Is that not possible at the moment?

Thanks!

Shaun

On Wed, Oct 12, 2011 at 2:30 PM, Matt Stevenson
<ma...@gmail.com>wrote:

> Sorry, I wasn't paying attention and thought the Java class was json.
>
> Save this as a .json:
>
>> {
>>     "name": "Message", "type": "record",
>>     "fields": [
>>         {"name": "to", "type": "string"},
>>         {"name": "from", "type": "string"},
>>         {"name": "body", "type": "string"}
>>     ]
>> }
>>
>
>
> On Wed, Oct 12, 2011 at 4:27 PM, Matt Stevenson <
> matt.r.stevenson@gmail.com> wrote:
>
>> The avrogencpp tool will only parse individual records.
>> If you save
>>
>> record Message {
>>  string to;
>>  string from;
>> string body;
>> }
>>
>> as a .json file, it will generate the class.
>> I think only records are supported in C++ and not full protocols.
>>
>>
>> On Wed, Oct 12, 2011 at 1:37 PM, Shaun Williams <sh...@gmail.com>wrote:
>>
>>> I'm trying to compile the Mail.avpr schema from the avro-rpc-quickstart
>>> example using the c++ tools, and precompile fails with the following error:
>>> "Failed to parse or compile schema: Schema is invalid, due to bad node of
>>> type symbolic."
>>>
>>> I even tried generating the avpr from an avdl, but precompile still fails
>>> with the same error.  Any idea what the problem might be?
>>>
>>> Here's my avdl FYI:
>>>
>>> @namespace("example.proto")
>>> protocol Mail{
>>> record Message {
>>> string to;
>>>  string from;
>>> string body;
>>> }
>>>
>>> string send(Message message);
>>> }
>>>
>>> Thanks!
>>>
>>
>>
>>
>> --
>> Matt Stevenson.
>>
>
>
>
> --
> Matt Stevenson.
>

Re: C++/Java schema compatibility

Posted by Matt Stevenson <ma...@gmail.com>.
Sorry, I wasn't paying attention and thought the Java class was json.

Save this as a .json:

> {
>     "name": "Message", "type": "record",
>     "fields": [
>         {"name": "to", "type": "string"},
>         {"name": "from", "type": "string"},
>         {"name": "body", "type": "string"}
>     ]
> }
>


On Wed, Oct 12, 2011 at 4:27 PM, Matt Stevenson
<ma...@gmail.com>wrote:

> The avrogencpp tool will only parse individual records.
> If you save
>
> record Message {
>  string to;
>  string from;
> string body;
> }
>
> as a .json file, it will generate the class.
> I think only records are supported in C++ and not full protocols.
>
>
> On Wed, Oct 12, 2011 at 1:37 PM, Shaun Williams <sh...@gmail.com>wrote:
>
>> I'm trying to compile the Mail.avpr schema from the avro-rpc-quickstart
>> example using the c++ tools, and precompile fails with the following error:
>> "Failed to parse or compile schema: Schema is invalid, due to bad node of
>> type symbolic."
>>
>> I even tried generating the avpr from an avdl, but precompile still fails
>> with the same error.  Any idea what the problem might be?
>>
>> Here's my avdl FYI:
>>
>> @namespace("example.proto")
>> protocol Mail{
>> record Message {
>> string to;
>>  string from;
>> string body;
>> }
>>
>> string send(Message message);
>> }
>>
>> Thanks!
>>
>
>
>
> --
> Matt Stevenson.
>



-- 
Matt Stevenson.

Re: C++/Java schema compatibility

Posted by Matt Stevenson <ma...@gmail.com>.
The avrogencpp tool will only parse individual records.
If you save
record Message {
string to;
 string from;
string body;
}

as a .json file, it will generate the class.
I think only records are supported in C++ and not full protocols.


On Wed, Oct 12, 2011 at 1:37 PM, Shaun Williams <sh...@gmail.com>wrote:

> I'm trying to compile the Mail.avpr schema from the avro-rpc-quickstart
> example using the c++ tools, and precompile fails with the following error:
> "Failed to parse or compile schema: Schema is invalid, due to bad node of
> type symbolic."
>
> I even tried generating the avpr from an avdl, but precompile still fails
> with the same error.  Any idea what the problem might be?
>
> Here's my avdl FYI:
>
> @namespace("example.proto")
> protocol Mail{
> record Message {
> string to;
>  string from;
> string body;
> }
>
> string send(Message message);
> }
>
> Thanks!
>



-- 
Matt Stevenson.