Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Threaded View
Avro >> mail # user >> Make a copy of an avro record


Copy link to this message
-
Re: Make a copy of an avro record
Yes. How do I instantiate an instance of GenericData though? It looks like
its constructors are protected.

Thanks
J

On Sun, Mar 11, 2012 at 1:52 PM, <[EMAIL PROTECTED]> wrote:

> There is deepcopy method on genericdata I think
>
> I used it to create deep copies of the avro data
>
> Sent from my iPhone
>
> On Mar 11, 2012, at 3:40 PM, Jeremy Lewi <[EMAIL PROTECTED]> wrote:
>
> > Hi,
> >
> > In java, I'd like to make a deep copy of an avro record.
> >
> > Looking at the code that the avro compiler generates it looks like the
> way to do this for records of type GraphNodeData
> > would be
> > GraphNodeData copy = GraphNodeData.newBuilder(existing_value).build();
> >
> > where GraphNodeData is the name of my avro record.
> >
> > Unfortunately, this generates a compile time error because
> > the method GraphNodeData.build  is decorated with "@Override" but it
> apparently does not override any method.
> > Deleting "@Override" makes the code work. Unfortunately, I would have to
> do this every time I regenerated my avro classes from the schema.
> >
> > Am I doing something wrong or should I file a bug?
> >
> > Thanks
> > J
>
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB