flatMap should help, it returns a Seq for every input.

On Mon, Oct 20, 2014 at 12:31 PM, HARIPRIYA AYYALASOMAYAJULA <
[email protected]> wrote:

> Hello,
>
> I am facing a problem with implementing this - My mapper should emit
> multiple keys for the same value -> for every input (k, v) it should emit
> (k, v), (k+1, v),(k+2,v).... (k+n,v).
> In MapReduce, it was pretty straight forward - I used a for loop and
> performed Context write within that.
>
> This is the code I am using in the map function of MR job:
>
> for (int k = 0; k <  8; k++)
>
>  {
>
>      key = date + ": " + k;
>
>  context.write(new Text(key), new DoubleWritable(value));
>
>    }
>
>   I tried using the map function, but i'm stuck in understanding how I can
> use the loop within it.
>
> It would be great if someone can suggest me what could be possible ways to
> do it.
>
> Thanks in advance.
>
> --
> Regards,
> Haripriya Ayyalasomayajula
>
>

Reply via email to