Return-Path: X-Original-To: apmail-avro-user-archive@www.apache.org Delivered-To: apmail-avro-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BDAF290DC for ; Mon, 2 Apr 2012 15:56:38 +0000 (UTC) Received: (qmail 11289 invoked by uid 500); 2 Apr 2012 15:56:38 -0000 Delivered-To: apmail-avro-user-archive@avro.apache.org Received: (qmail 11105 invoked by uid 500); 2 Apr 2012 15:56:38 -0000 Mailing-List: contact user-help@avro.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@avro.apache.org Delivered-To: mailing list user@avro.apache.org Received: (qmail 11097 invoked by uid 99); 2 Apr 2012 15:56:38 -0000 Received: from minotaur.apache.org (HELO minotaur.apache.org) (140.211.11.9) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Apr 2012 15:56:38 +0000 Received: from localhost (HELO [10.0.0.196]) (127.0.0.1) (smtp-auth username scottcarey, mechanism login) by minotaur.apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Apr 2012 15:56:38 +0000 User-Agent: Microsoft-MacOutlook/14.14.0.111121 Date: Mon, 02 Apr 2012 08:56:26 -0700 Subject: Re: read a compressed avro file From: Scott Carey Sender: Scott Carey To: Message-ID: Thread-Topic: read a compressed avro file In-Reply-To: Mime-version: 1.0 Content-type: multipart/alternative; boundary="B_3416201797_17721562" > This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --B_3416201797_17721562 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit Reading an Avro file is the same for all compression types. The header of the file contains what compression codec is used and the schema for the data within it. A basic read may look like: DataFileReader reader = new DataFileReader(myFile, new GenericDatumReader()); try { for(Object datum : reader) { // do something with the datum } } finally { reader.close(); } The documentation is here: http://avro.apache.org/docs/1.6.3/api/java/org/apache/avro/file/DataFileRead er.html or http://avro.apache.org/docs/1.6.3/api/java/org/apache/avro/file/DataFileStre am.html Several examples can be found in the unit tests named TestDataFile*.java: http://svn.apache.org/viewvc/avro/tags/release-1.6.3/lang/java/avro/src/test /java/org/apache/avro/ On 3/30/12 11:10 PM, "Weishung Chung" wrote: > java > > On Sat, Mar 31, 2012 at 12:44 AM, Miki Tebeka wrote: >>> > Could you guide me to an example on how to read a compressed avro file >>> > (snappy) ? >> In which programming language? > --B_3416201797_17721562 Content-type: text/html; charset="US-ASCII" Content-transfer-encoding: quoted-printable
Reading an Avro file is the same for = all compression types. The header of the file contains what compression code= c is used and the schema for the data within it.

A = basic read may look like:

DataFileReader<Ob=
ject> reader =3D new DataFileReader<Object>(myFile, new GenericDatumR=
eader<Object>());
try {
  for(Object datum : reader) {
    // do something with the datum
  }
} finally {
  reader.close();
}
Several examples can be found in the unit tests named TestD= ataFile*.java:


On 3/30/12 11:10 PM, "Weishung Chung" <weishung@gmail.com> wrote:

java 

On Sat, Mar 31, 2012 at 12:44 AM, Miki Tebeka <= ;miki.tebeka@gmail.com>= wrote:
> Could you guide me= to an example on how to read a compressed avro file
> (snappy) ?
In which programming language?

--B_3416201797_17721562--