0
私はHBaseを読み込んでファイルにレコードを書き込むアプリケーションを持っています。 最終出力は、hadoopでサポートされていない形式の.zip圧縮形式である必要があります。 このため私はカスタムZipFileOutputFormatを使って.zipファイルにレコードを取得しています。ここでZip形式の出力を与えないZipFileOutputFormat mapreduce
は、これは私がR-000001の形式で任意のエラーが、それでも中に私の出力を得ていないのですZipFileOutputFormat.class
public class ZipFileOutputFormat extends FileOutputFormat<NullWritable, Text> {
@Override
public RecordWriter<NullWritable, Text> getRecordWriter(
TaskAttemptContext job) throws IOException, InterruptedException {
Path file = getDefaultWorkFile(job, ".zip");
FileSystem fs = file.getFileSystem(job.getConfiguration());
return new ZipRecordWriter(fs.create(file, false));
}
public static class ZipRecordWriter extends
RecordWriter<NullWritable, Text> {
protected ZipOutputStream zos;
public ZipRecordWriter(FSDataOutputStream os) {
zos = new ZipOutputStream(os);
}
@Override
public void write(NullWritable key, Text value) throws IOException,
InterruptedException {
// TODO: create new ZipEntry & add to the ZipOutputStream (zos)
}
@Override
public void close(TaskAttemptContext context) throws IOException,
InterruptedException {
zos.close();
}
}
}
の詳細である私の実装
ZipFileOutputFormat.setOutputPath(job, new Path(args[1]));
です。
ここに設定がありません。