KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
My program looks like public class TopKRecord extends Configured implements Tool { public static class MapClass extends Mapper<Text, Text, Text, Text> { public void map(Text key, Text value, Context context) throws IOException, InterruptedException { // your map code goes here String[] fields = value.toString().split(","); String year = fields[1]; String claims = fields[8]; if (claims.length() > 0 && (!claims.startsWith("\""))) { context.write(new Text(year.toString()), new Text(claims.toString())); } } } public int run(String args[]) throws Exception { Job job = new Job(); job.setJarByClass(TopKRecord.class); job.setMapperClass(MapClass.class); FileInputFormat.setInputPaths(job, new Path(args[0])); FileOutputFormat.setOutputPath(job, new Path(args[1])); job.setJobName("TopKRecord"); job.setMapOutputValueClass(Text.class); job.setNumReduceTasks(0); boolean success = job.waitForCompletion(true); return success ? 0 : 1; } public static void main(String args[]) throws Exception { int ret = ToolRunner.run(new TopKRecord(), args); System.exit(ret); } } The data looks like "PATENT","GYEAR","GDATE","APPYEAR","COUNTRY","POSTATE","ASSIGNEE","ASSCODE","CLAIMS","NCLASS","CAT","SUBCAT","CMADE","CRECEIVE","RATIOCIT","GENERAL","ORIGINAL","FWDAPLAG","BCKGTLAG","SELFCTUB","SELFCTLB","SECDUPBD","SECDLWBD" 3070801,1963,1096,,"BE","",,1,,269,6,69,,1,,0,,,,,,, 3070802,1963,1096,,"US","TX",,1,,2,6,63,,0,,,,,,,,, 3070803,1963,1096,,"US","IL",,1,,2,6,63,,9,,0.3704,,,,,,, 3070804,1963,1096,,"US","OH",,1,,2,6,63,,3,,0.6667,,,,,,, On running this program I see the following on console 12/08/02 12:43:34 INFO mapred.JobClient: Task Id : attempt_201208021025_0007_m_
Tags (comma-separated)
Save Edits
Cancel