毕业论文开发语言企业开发JAVA技术.NET技术WEB开发Linux/Unix数据库技术Windows平台移动平台嵌入式论文范文英语论文
您现在的位置: 毕业论文 >> 开发语言 >> 正文

Hadoop自定义输出的代码 第9页

更新时间:2014-11-20:  来源:毕业论文
p;            super();   
                this.job = job;   
                this.workPath = workPath;   
                recordWriters = new HashMap<String, RecordWriter<K, V>>();   
            }   
            @Override   
            public void close(TaskAttemptContext context) throws IOException, InterruptedException {   
                Iterator<RecordWriter<K, V>> values = this.recordWriters.values().iterator();   
                while (values.hasNext()) {   
                    values.next().close(context);   
                }   
                this.recordWriters.clear();   
            }   
            @Override   
            public void write(K key, V value) throws IOException, InterruptedException {   
                //得到输出文件名   
                String baseName = generateFileNameForKeyValue(key, value, job.getConfiguration());   
                RecordWriter<K, V> rw = this.recordWriters.get(baseName);   
                if (rw == null) {   
                    rw = getBaseRecordWriter(job, baseName);   
                    this.recordWriters.put(baseName, rw);   
                }   
                rw.write(key, value);   
            }   
            // ${mapred.out.dir}/_temporary/_${taskid}/${nameWithExtension}   
            private RecordWriter<K, V> getBaseRecordWriter(TaskAttemptContext job, String baseName)   
                    throws IOException, InterruptedException {   
                Configuration conf = job.getConfiguration();   
                boolean isCompressed = getCompressOutput(job);   
                String keyValueSeparator = ",";   
                RecordWriter<K, V> recordWriter = null;   
                if (isCompressed) {   
                    Class<? extends CompressionCodec> codecClass = getOutputCompressorClass(job,   
                        &n

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] 下一页

设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©youerw.com 优尔论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。