chengshiwen commented on issue #4438:
URL: 
https://github.com/apache/incubator-dolphinscheduler/issues/4438#issuecomment-759433321


   @Slivery1 
   Do you use the `GenericOptionsParser` to handle generic Hadoop command-line 
options? Like the follows?
   ```
   public static void main(String[] args) throws Exception {
     Configuration conf = new Configuration();
     GenericOptionsParser optionParser = new GenericOptionsParser(conf, args);
     String[] remainingArgs = optionParser.getRemainingArgs();
     if ((remainingArgs.length != 2) && (remainingArgs.length != 4)) {
       System.err.println("Usage: wordcount <in> <out> [-skip 
skipPatternFile]");
       System.exit(2);
     }
     Job job = Job.getInstance(conf, "word count");
     job.setJarByClass(WordCount2.class);
     job.setMapperClass(TokenizerMapper.class);
     job.setCombinerClass(IntSumReducer.class);
     job.setReducerClass(IntSumReducer.class);
     job.setOutputKeyClass(Text.class);
     job.setOutputValueClass(IntWritable.class);
   
     List<String> otherArgs = new ArrayList<String>();
     for (int i=0; i < remainingArgs.length; ++i) {
       if ("-skip".equals(remainingArgs[i])) {
         job.addCacheFile(new Path(remainingArgs[++i]).toUri());
         job.getConfiguration().setBoolean("wordcount.skip.patterns", true);
       } else {
         otherArgs.add(remainingArgs[i]);
       }
     }
     FileInputFormat.addInputPath(job, new Path(otherArgs.get(0)));
     FileOutputFormat.setOutputPath(job, new Path(otherArgs.get(1)));
   
     System.exit(job.waitForCompletion(true) ? 0 : 1);
   }
   ```
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to