You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@avro.apache.org by tazan007 <ta...@gmail.com> on 2009/08/03 21:27:04 UTC

Type unsupported: string error with Schema.java:704

Hi guys, I am getting this error with the following schema:

{"namespace": "rpc.test",
 "protocol": "ds_rpc",

"types": [
     {"name": "RequestID", "type": "string"},
     {"name": "ClientID", "type": "string"}
 ],

 "messages": {

     "helo": {
         "request": [{"name": "helo", "type": "ClientID"}],
         "response": "RequestID"
     }
 }

}

throws this error:

Caused by: org.apache.avro.SchemaParseException: Type not yet supported:
string
    at org.apache.avro.Schema.parse(Schema.java:704)
    at org.apache.avro.Protocol.parseTypes(Protocol.java:279)
    at org.apache.avro.Protocol.parse(Protocol.java:253)
    at org.apache.avro.Protocol.parse(Protocol.java:243)
    at org.apache.avro.Protocol.parse(Protocol.java:227)

If I change the types to the following, it fixes the error:

{"namespace": "rpc.test",
 "protocol": "ds_rpc",

"types": [
*     {"name": "RequestID", "type":"record", "fields" : [
                        {"name":"id","type": "string"}]},
     {"name": "ClientID", "type":"record", "fields" : [
                        {"name":"id","type": "string"}]}*
 ],

 "messages": {

     "helo": {
         "request": [{"name": "helo", "type": "ClientID"}],
         "response": "RequestID"
     }
 }

}


Is this expeceted behavior?  Do the types have to be complex if they are
named types?

Thanks,
Hiral

Re: Type unsupported: string error with Schema.java:704

Posted by George Porter <gm...@gmail.com>.
I ran into this exact same error for a simple key/value store I was
writing.  I ended up getting rid of the named types ("RequestID" and
"ClientID") and just made the method signature take a string (in this
case).

I'd be interested in finding out what solution you came across for
this.  I'm a JSON novice so I wasn't sure if the issue was in Avro or
JSON.

Thanks,
-George

On Mon, Aug 3, 2009 at 12:27 PM, tazan007<ta...@gmail.com> wrote:
> Hi guys, I am getting this error with the following schema:
>
> {"namespace": "rpc.test",
>  "protocol": "ds_rpc",
>
> "types": [
>      {"name": "RequestID", "type": "string"},
>      {"name": "ClientID", "type": "string"}
>  ],
>
>  "messages": {
>
>      "helo": {
>          "request": [{"name": "helo", "type": "ClientID"}],
>          "response": "RequestID"
>      }
>  }
>
> }
>
> throws this error:
>
> Caused by: org.apache.avro.SchemaParseException: Type not yet supported:
> string
>     at org.apache.avro.Schema.parse(Schema.java:704)
>     at org.apache.avro.Protocol.parseTypes(Protocol.java:279)
>     at org.apache.avro.Protocol.parse(Protocol.java:253)
>     at org.apache.avro.Protocol.parse(Protocol.java:243)
>     at org.apache.avro.Protocol.parse(Protocol.java:227)
>
> If I change the types to the following, it fixes the error:
>
> {"namespace": "rpc.test",
>  "protocol": "ds_rpc",
>
> "types": [
>      {"name": "RequestID", "type":"record", "fields" : [
>                         {"name":"id","type": "string"}]},
>      {"name": "ClientID", "type":"record", "fields" : [
>                         {"name":"id","type": "string"}]}
>  ],
>
>  "messages": {
>
>      "helo": {
>          "request": [{"name": "helo", "type": "ClientID"}],
>          "response": "RequestID"
>      }
>  }
>
> }
>
>
> Is this expeceted behavior?  Do the types have to be complex if they are
> named types?
>
> Thanks,
> Hiral
>

Re: Type unsupported: string error with Schema.java:704

Posted by Doug Cutting <cu...@apache.org>.
Yes, we certainly need better documentation here.

The FAQ in the wiki is a fine place to start.

We should also probably improve the official documentation, e.g., the 
spec and javadocs.  For example, the table mapping Avro types to Java 
types in the generic docs should perhaps be linked to from the specific 
and reflect documentation.  And more examples would help, both in the 
docs and perhaps in the src/test code tree, or in a new src/examples 
tree.  Maybe we need a Java tutorial document, walking through use of 
each API?

Doug

George Porter wrote:
> Thanks for this clarification.  Looking closer at the spec that does make sense.
> 
> Since both tazan007 and I were thrown by it, maybe we could make that
> more explicit or add it to a FAQ?  I'd be happy to update the wiki as
> appropriate.  Thoughts?
> 
> -George
> 
> On Thu, Aug 6, 2009 at 2:38 PM, Doug Cutting<cu...@apache.org> wrote:
>> tazan007 wrote:
>>> Caused by: org.apache.avro.SchemaParseException: Type not yet supported:
>>> string
>> [ ...]
>>> Is this expeceted behavior?  Do the types have to be complex if they are
>>> named types?
>> Yes.  The only named types are record, enum, and fixed, and only these are
>> permitted in the "types" section of a protocol.
>>
>> http://hadoop.apache.org//avro/docs/current/spec.html#Protocol+Declaration
>>
>> Like Java, Avro protocols have no typedef.  You could instead define a
>> record with a single field.  This would not alter what's serialized, since
>> records add no serialization overhead, but would make for stronger typing.
>>
>> Doug
>>
>>
>>

Re: Type unsupported: string error with Schema.java:704

Posted by George Porter <gm...@gmail.com>.
Thanks for this clarification.  Looking closer at the spec that does make sense.

Since both tazan007 and I were thrown by it, maybe we could make that
more explicit or add it to a FAQ?  I'd be happy to update the wiki as
appropriate.  Thoughts?

-George

On Thu, Aug 6, 2009 at 2:38 PM, Doug Cutting<cu...@apache.org> wrote:
> tazan007 wrote:
>>
>> Caused by: org.apache.avro.SchemaParseException: Type not yet supported:
>> string
>
> [ ...]
>>
>> Is this expeceted behavior?  Do the types have to be complex if they are
>> named types?
>
> Yes.  The only named types are record, enum, and fixed, and only these are
> permitted in the "types" section of a protocol.
>
> http://hadoop.apache.org//avro/docs/current/spec.html#Protocol+Declaration
>
> Like Java, Avro protocols have no typedef.  You could instead define a
> record with a single field.  This would not alter what's serialized, since
> records add no serialization overhead, but would make for stronger typing.
>
> Doug
>
>
>

Re: Type unsupported: string error with Schema.java:704

Posted by Doug Cutting <cu...@apache.org>.
tazan007 wrote:
> Caused by: org.apache.avro.SchemaParseException: Type not yet supported: 
> string
[ ...]
> Is this expeceted behavior?  Do the types have to be complex if they are 
> named types?

Yes.  The only named types are record, enum, and fixed, and only these 
are permitted in the "types" section of a protocol.

http://hadoop.apache.org//avro/docs/current/spec.html#Protocol+Declaration

Like Java, Avro protocols have no typedef.  You could instead define a 
record with a single field.  This would not alter what's serialized, 
since records add no serialization overhead, but would make for stronger 
typing.

Doug