You can also use a MapRunnable implementation but that would allow "global" only to each Map task.

Dennis Kubes

James Yu wrote:
For example:

I put all user global variables in a class I called MyGlobals

public class MyGlobals {
    static public int var1;
    ...
}

Then, in whatever map function I have, I can refer to my globals like this:

public void map(LongWritable key, Text value, OutputCollector output,
Reporter reporter) throws IOException {
....
 int i = MyGlobals.var1;
...
}

Sorry about the stupid question and answer.

On 10/11/07, Bob Futrelle <[EMAIL PROTECTED]> wrote:
Yeah, but what's the answer?

- rpf

On 10/11/07, James Yu <[EMAIL PROTECTED]> wrote:
Problem solved. Please ignore.

On 10/11/07, James Yu <[EMAIL PROTECTED]> wrote:
A very basic question:  where to store my personal global variables
such
that the map and/or reduce functions can see it?

Thanks,
James


Reply via email to