コード例 #1
0
            /// <exception cref="System.IO.IOException"/>
            /// <exception cref="System.Exception"/>
            public override RecordReader <K, V> CreateRecordReader(InputSplit split, TaskAttemptContext
                                                                   context)
            {
                Configuration      conf    = context.GetConfiguration();
                InputFormat <K, V> indirIF = (InputFormat)ReflectionUtils.NewInstance(conf.GetClass
                                                                                          (IndirectInputFormat, typeof(SequenceFileInputFormat)), conf);

                GenericMRLoadGenerator.IndirectInputFormat.IndirectSplit @is = ((GenericMRLoadGenerator.IndirectInputFormat.IndirectSplit
                                                                                 )split);
                return(indirIF.CreateRecordReader(new FileSplit(@is.GetPath(), 0, @is.GetLength()
                                                                , (string[])null), context));
            }
コード例 #2
0
        /// <exception cref="System.IO.IOException"/>
        /// <exception cref="System.Exception"/>
        /// <exception cref="System.TypeLoadException"/>
        private int WriteNewSplits <T>(JobContext job, Path jobSubmitDir)
            where T : InputSplit
        {
            Configuration conf = job.GetConfiguration();
            InputFormat <object, object> input = ReflectionUtils.NewInstance(job.GetInputFormatClass
                                                                                 (), conf);
            IList <InputSplit> splits = input.GetSplits(job);

            T[] array = (T[])Sharpen.Collections.ToArray(splits, new InputSplit[splits.Count]
                                                         );
            // sort the splits into order based on size, so that the biggest
            // go first
            Arrays.Sort(array, new JobSubmitter.SplitComparator());
            JobSplitWriter.CreateSplitFiles(jobSubmitDir, conf, jobSubmitDir.GetFileSystem(conf
                                                                                           ), array);
            return(array.Length);
        }