avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Kleppmann <mar...@rapportive.com>
Subject Re: How to convert .avpr/.avdl file to .avsc file.
Date Wed, 20 Mar 2013 12:13:44 GMT
Hi Sourabh,

As far as I know, there is no automatic conversion between .avpr/.avdl
and .avsc, because they are different things: avpr/avdl describes a
protocol, i.e. various messages that can be exchanged over an API,
which can include any number of schemas. avsc only contains a single
record schema (with possible nested schemas).

Your best bet is probably to use the IDL command-line tool to convert
.avdl to .avpr (http://avro.apache.org/docs/current/idl.html), then to
manually edit the .avpr file and extract the schema you want. It's
just JSON, so it's not too hard to edit. Find the schema for the event
type you have in hive, which should be of the form:

{"type": "record", "name": "MyEventType", "fields": [...]}

and discard the rest of the .avpr file. That record definition is your
.avsc file.


(dev@avro to BCC)

On 20 March 2013 11:11, sourabh chaki <chaki.sourabh@gmail.com> wrote:
> Hi All,
> In my application I am getting events in avro serialized format.These data
> are serialized using .avdl file in java.
> In my application I have to parse those events in hive. In web tutorial I
> can see ,hive understands .avsc format.
> https://cwiki.apache.org/Hive/avroserde-working-with-avro-from-hive.html
> Is there any way to convert .avpr to .avsc ?
> Alternately can I directly use .avpr/.avdl in hive? Please provide example.
> Thanks in advance.
> Sourabh

View raw message