Note that there are some explanatory texts on larger screens.

plurals
  1. POError in setting job.setInputFormatClass in Mapreduce
    text
    copied!<p>I am running a MapReduce program. I need to give input text file in the format of KEYVALUE pair. so that If I write </p> <pre><code>job.setInputFormatClass(KeyValueTextInputFormat.class); </code></pre> <p>The eclipse compiler is showing error that I cant use InputFormat. anyhow I need to set the Input's format as KeyValueTextInputFormat How do I do this ?? Any IDea ?????</p> <p>My Code is </p> <p>`</p> <pre><code>package com.iot.dictionary; import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapred.KeyValueTextInputFormat; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.mapreduce.lib.input.FileInputFormat; import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat; import org.apache.hadoop.util.GenericOptionsParser; import com.iot.dictionary.Dictionary.AllTranslationsReducer; import com.iot.dictionary.Dictionary.WordMapper; public class Driver2 { public static void main(String[] args) throws IOException, ClassNotFoundException, InterruptedException { Configuration conf = new Configuration(); String[] otherArgs = new GenericOptionsParser(conf, args).getRemainingArgs(); if (otherArgs.length != 2) { System.err.println("Usage: wordcount &lt;in&gt; &lt;out&gt;"); System.exit(2); } Job job = new Job(conf, "dictionary"); System.out.println("Job-&gt; "+job.toString()); job.setJarByClass(Dictionary.class); job.setMapperClass(WordMapper.class); job.setReducerClass(AllTranslationsReducer.class); job.setOutputKeyClass(Text.class); job.setOutputValueClass(Text.class); job.setInputFormatClass(KeyValueTextInputFormat.class); FileInputFormat.addInputPath(job, new Path(otherArgs[0])); FileOutputFormat.setOutputPath(job, new Path(otherArgs[1])); System.exit(job.waitForCompletion(true) ? 0 : 1); } } </code></pre> <p>`</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload