FAQ
Hi Phantom

To operate the Mapfile isn't difficult by itself, simply follow the order
1) create the mapfile writer or reader by specifying the JobConf, file
system, the path name of the mapfile. If creating the MapFile you also need
to specify the key class(shall implement
org.apache.hadoop.io.WritableComparable) and value class (shall implement
org.apache.hadoop.io.Writable).

/* create the MapFile writer and write to it */
MapFile.Writer writer = new MapFile.Writer(conf, fs, dir,
MyKey.class, MyValue.class,
SequenceFile.CompressionType.BLOCK);
MyKey key = new MyKey();
MyValue value = new MyValue();
writer.append(key, value);

/* create the MapFile reader and read from it */
MapFile.Reader reader = new MapFile.Reader(fs, dir, conf);
MyKey key = new MyKey();
MyValue value = new MyValue();
while (reader.next(key, value))
{
// do sth with the key and value
}

You can also turn to the source code of Nutch,
org.apache.nutch.fetcher.FetcherOutputFormat for referrence.
On 7/3/07, Phantom wrote:

Would someone be kind enough to share with me any code/sample they have
for
using the MapFile class ?

Thanks
A

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 2 | next ›
Discussion Overview
groupcommon-user @
categorieshadoop
postedJul 2, '07 at 6:50p
activeJul 4, '07 at 9:09a
posts2
users2
websitehadoop.apache.org...
irc#hadoop

2 users in discussion

Open Study: 1 post Phantom: 1 post

People

Translate

site design / logo © 2022 Grokbase