Wordcount program in Hadoop by using Cloudera

Поделиться
HTML-код
  • Опубликовано: 15 фев 2024
  • WordCount Program in Hadoop
    hadoop.apache.org/docs/curren...
    Copy that code .......
    paste into class

Комментарии • 24

  • @yashpathak8075
    @yashpathak8075 5 месяцев назад +2

    very good Amazing explanation

  • @mahmoodshariff5586
    @mahmoodshariff5586 2 месяца назад +1

    Thank you mam, I was trying this program in Cloudera but it is not getting and I was unable to find the where problem occurred. But finally your video explanation helped me mam. Thank you

  • @lokeshpatil1745
    @lokeshpatil1745 5 месяцев назад +1

    Nice explanation..it's really helpful 👍👍

  • @pratimabharati502
    @pratimabharati502 5 месяцев назад +1

    Keep it up mam😊

  • @vaishnavikamble5492
    @vaishnavikamble5492 5 месяцев назад +1

    Nice explanation 😊

  • @Rahul_Valvi_Creation_
    @Rahul_Valvi_Creation_ 5 месяцев назад +1

    Nice explanation mam ❤️❤️

  • @radhikakokate648
    @radhikakokate648 5 месяцев назад +1

    Nice Explanation, clear all concept

  • @ankursatao5344
    @ankursatao5344 5 месяцев назад +1

    Well explained

  • @ankushupadhayay6847
    @ankushupadhayay6847 5 месяцев назад +1

    well explained 👏

  • @rakshapanpaliya6131
    @rakshapanpaliya6131 5 месяцев назад +1

    Helpful

  • @sanikamote2568
    @sanikamote2568 5 месяцев назад +1

    Helpful❤

  • @munigoutham4371
    @munigoutham4371 9 дней назад

    Not a Valid Jar error

  • @shivanikarhalesuryawanshi
    @shivanikarhalesuryawanshi  5 месяцев назад +2

    import java.io.IOException;
    import java.util.StringTokenizer;
    import org.apache.hadoop.conf.Configuration;
    import org.apache.hadoop.fs.Path;
    import org.apache.hadoop.io.IntWritable;
    import org.apache.hadoop.io.Text;
    import org.apache.hadoop.mapreduce.Job;
    import org.apache.hadoop.mapreduce.Mapper;
    import org.apache.hadoop.mapreduce.Reducer;
    import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
    import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
    public class WordCount {
    public static class TokenizerMapper
    extends Mapper{
    private final static IntWritable one = new IntWritable(1);
    private Text word = new Text();
    public void map(Object key, Text value, Context context
    ) throws IOException, InterruptedException {
    StringTokenizer itr = new StringTokenizer(value.toString());
    while (itr.hasMoreTokens()) {
    word.set(itr.nextToken());
    context.write(word, one);
    }
    }
    }
    public static class IntSumReducer
    extends Reducer {
    private IntWritable result = new IntWritable();
    public void reduce(Text key, Iterable values,
    Context context
    ) throws IOException, InterruptedException {
    int sum = 0;
    for (IntWritable val : values) {
    sum += val.get();
    }
    result.set(sum);
    context.write(key, result);
    }
    }
    public static void main(String[] args) throws Exception {
    Configuration conf = new Configuration();
    Job job = Job.getInstance(conf, "word count");
    job.setJarByClass(WordCount.class);
    job.setMapperClass(TokenizerMapper.class);
    job.setCombinerClass(IntSumReducer.class);
    job.setReducerClass(IntSumReducer.class);
    job.setOutputKeyClass(Text.class);
    job.setOutputValueClass(IntWritable.class);
    FileInputFormat.addInputPath(job, new Path(args[0]));
    FileOutputFormat.setOutputPath(job, new Path(args[1]));
    System.exit(job.waitForCompletion(true) ? 0 : 1);
    }
    }