Re: How to install avro under ruby?
Hey Edward it should go simply as gem install avrò Unfortunately there is a bug currently but you can easily circumvent it by following this http://mail-archives.apache.org/mod_mbox/avro-user/201402.mbox/browser The ticket with a patch is here https://issues.apache.org/jira/browse/AVRO-1459 there is also a neat blog that could get you started here http://www.igvita.com/2010/02/16/data-serialization-rpc-with-avro-ruby/ hope this helps. Tomas On Thu, Feb 20, 2014 at 6:45 PM, EdwardKing zhan...@neusoft.com wrote: My OS is CentOS and ruby is 2.1, I want to use avro under ruby, like follows: the file generate.rb is follows: require 'rubygems' require 'avro' . so I download avro-1.7.6.gem and avro-src-1.7.6.tar.gz, but I don't know how to install avro under ruby. Anyone could give me a details command of installing avro under ruby? Thanks. --- Confidentiality Notice: The information contained in this e-mail and any accompanying attachment(s) is intended only for the use of the intended recipient and may be confidential and/or privileged of Neusoft Corporation, its subsidiaries and/or its affiliates. If any reader of this communication is not the intended recipient, unauthorized use, forwarding, printing, storing, disclosure or copying is strictly prohibited, and may be unlawful.If you have received this communication in error,please immediately notify the sender by return e-mail, and delete the original message and all copies from your system. Thank you. ---
Re: Avro schema in Ruby API
Hey Harsh, thanks. I can confirm that the first one works. Let me try the second one. Tomas On Sun, Feb 16, 2014 at 8:07 AM, Harsh J ha...@cloudera.com wrote: Hi, For (1) I believe you could do a Schema.parse meta['avro.schema'] to obtain the schema as an object from the meta entry of the file. For (2), as defined in the spec at http://avro.apache.org/docs/current/spec.html#Object+Container+Files, since the schema is stored only in the header of the file, using a simple initialised reader will be efficient in reading just that. The file's data blocks are read only upon enumerating over the reader. On Sun, Feb 16, 2014 at 4:52 AM, Tomas Svarovsky svarovsky.to...@gmail.com wrote: Hey, I wanted to ask couple of questions. 1) Let's assume I have 2 avro files. I would like to grab schemas of both. Compare them and decide what to do. The only way I found to get to the schema in a reader is through dr = Avro::DataFile::Reader.new(file, Avro::IO::DatumReader.new) dr.meta and that is still stringified JSON. Is this the only way or even is this use case something supported or should I do it differently? 2) Also is ti possible to read just the schema? Sometimes it is useful to look at a file without actually reading the whole file let's say from s3. Regards Tomas -- Harsh J
Avro schema in Ruby API
Hey, I wanted to ask couple of questions. 1) Let's assume I have 2 avro files. I would like to grab schemas of both. Compare them and decide what to do. The only way I found to get to the schema in a reader is through dr = Avro::DataFile::Reader.new(file, Avro::IO::DatumReader.new) dr.meta and that is still stringified JSON. Is this the only way or even is this use case something supported or should I do it differently? 2) Also is ti possible to read just the schema? Sometimes it is useful to look at a file without actually reading the whole file let's say from s3. Regards Tomas