コード例 #1
0
ファイル: LocalJobRunner.cs プロジェクト: orf53975/hadoop.net
            /// <exception cref="System.Exception"/>
            private OutputCommitter CreateOutputCommitter(bool newApiCommitter, JobID jobId,
                                                          Configuration conf)
            {
                OutputCommitter committer = null;

                LocalJobRunner.Log.Info("OutputCommitter set in config " + conf.Get("mapred.output.committer.class"
                                                                                    ));
                if (newApiCommitter)
                {
                    TaskID             taskId        = new TaskID(jobId, TaskType.Map, 0);
                    TaskAttemptID      taskAttemptID = new TaskAttemptID(taskId, 0);
                    TaskAttemptContext taskContext   = new TaskAttemptContextImpl(conf, taskAttemptID);
                    OutputFormat       outputFormat  = ReflectionUtils.NewInstance(taskContext.GetOutputFormatClass
                                                                                       (), conf);
                    committer = outputFormat.GetOutputCommitter(taskContext);
                }
                else
                {
                    committer = ReflectionUtils.NewInstance(conf.GetClass <OutputCommitter>("mapred.output.committer.class"
                                                                                            , typeof(FileOutputCommitter)), conf);
                }
                LocalJobRunner.Log.Info("OutputCommitter is " + committer.GetType().FullName);
                return(committer);
            }