You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@avro.apache.org by Lewis John Mcgibbney <le...@gmail.com> on 2014/02/26 13:58:06 UTC
Re: How to create a avro file?
Hi EdwardKing,
On Mon, Feb 24, 2014 at 1:53 AM, EdwardKing <zh...@neusoft.com> wrote:
> I want to create a avro file named sightings.avro,it's structure is
> follows:
> { "type": "record",
> "name": "UFO_Sighting_Record",
> "fields" : [
> {"name": "sighting_date", "type": "string"},
> {"name": "city", "type": "string"},
> {"name": "shape", "type": ["null", "string"]},
> {"name": "duration", "type": "float"}
> ]
> }
>
Schema definition looks fine apart from the name. You will wish to edit
this to sightings
> I want to use java to create above sightings.avro file,but I am a newbie
> to avro 1.7.6,I don't know how to realized it. Anyone could give me an demo
> to do it? Thanks in advance.
>
Take a look at the current documentation for the Java API. It is very
comprehensive.
http://avro.apache.org/docs/current/gettingstartedjava.html
Also you should want to look through some mailing list questions. Reading
CSV data and serializing it outside of a MR environment is certainly in
previously asked questions.
hth
Lewis