hadoop-mapreduce-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Zhang <zjf...@gmail.com>
Subject Re: help with rewriting hadoop java code for new API: RecordReader getPos()
Date Wed, 27 Oct 2010 09:47:31 GMT
pos can been get through InputStream wrapped in RecordReader.  You can
refer to org.apache.hadoop.mapreduce.lib.input.LineRecordReader for
details.


On Wed, Oct 27, 2010 at 5:37 PM, Bibek Paudel <eternalyouth@gmail.com> wrote:
> [Apologies for cross-posting]
>
> HI all,
> I am rewriting a hadoop java code for the new (0.20.2) API- the code
> was originally written for versions <= 0.19.
>
> 1. What is the equivalent of getPos() method [0] of RecordReader ?
>
> I read that in 0.20, the getPos() methos is no longer there [1], but what
> am I supposed to replace it with?
>
> For example, in a map function, I have (RecordReader<IntWritable,
> CustomInput> input, Context context) and in the function body, I have:
> long pos = -1;
> pos = input.getPos();
> while(input.next(key, value)){
> //some code here
> }
>
> and I get the error: The method getPos() is undefined for the type
> RecordReader<IntWritable,CustomInput>
>
> Any pointers or help will be highly appreciated.
>
> Thanks,
> Bibek
>
> [0] http://hadoop.apache.org/common/docs/r0.20.1/api/org/apache/hadoop/mapred/RecordReader.html#getPos%28%29
> [1] http://www.slideshare.net/sh1mmer/upgrading-to-the-new-map-reduce-api
>



-- 
Best Regards

Jeff Zhang

Mime
View raw message