Advantages of using NullWritable in Hadoop

前端 未结 3 1623
时光说笑
时光说笑 2021-01-30 11:18

What are the advantages of using NullWritable for null keys/values over using null texts (i.e. new Text(null)). I see the fol

3条回答
  •  情深已故
    2021-01-30 11:45

    I change the run method. and success

    @Override
    public int run(String[] strings) throws Exception {
        Configuration config = HBaseConfiguration.create();  
        //set job name
        Job job = new Job(config, "Import from file ");
        job.setJarByClass(LogRun.class);
        //set map class
        job.setMapperClass(LogMapper.class);
    
        //set output format and output table name
        //job.setOutputFormatClass(TableOutputFormat.class);
        //job.getConfiguration().set(TableOutputFormat.OUTPUT_TABLE, "crm_data");
        //job.setOutputKeyClass(ImmutableBytesWritable.class);
        //job.setOutputValueClass(Put.class);
    
        TableMapReduceUtil.initTableReducerJob("crm_data", null, job);
        job.setNumReduceTasks(0);
        TableMapReduceUtil.addDependencyJars(job);
    
        FileInputFormat.addInputPath(job, new Path(strings[0]));
    
        int ret = job.waitForCompletion(true) ? 0 : 1;
        return ret;
    }
    

提交回复
热议问题