As per my understanding declaring static variables within the map class rather than the outer class should be fine. Otherwise it may be a problem as map function will be replicated in all the nodes.
-----Original Message----- From: [email protected] [mailto:[email protected]] Sent: Thursday, July 09, 2009 11:05 AM To: [email protected] Subject: Accessing static variables in map function Hi . I am a beginner to the Hadoop Map/Reduce Framework. Is there a way I can access the static variables declared in my class in the map function ? It goes like : public class test extends Configured implements Tool { static String storyVersion = null; static String storySize = null; static String storyTimestamp = null; public static class MapClass extends MapReduceBase implements Mapper<LongWritable, Text, Text, Text> { // LongWritable private Text keytext = new Text(); @SuppressWarnings("unchecked") public void map(LongWritable key, Text value, OutputCollector<Text, Text> output, Reporter reporter) throws IOException { // Access the static variables here } : : : } - Hrishi __________________________________________________________________ Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark your favourite sites. Download it now http://ca.toolbar.yahoo.com.
