List of usage examples for org.apache.hadoop.mapred FileOutputFormat getTaskOutputPath
public static Path getTaskOutputPath(JobConf conf, String name) throws IOException
From source file:com.ricemap.spateDB.util.ImageOutputFormat.java
License:Apache License
@Override public RecordWriter<Prism, ImageWritable> getRecordWriter(FileSystem ignored, JobConf job, String name, Progressable progress) throws IOException { this.progress = progress; Path file = FileOutputFormat.getTaskOutputPath(job, name); FileSystem fs = file.getFileSystem(job); Prism fileMbr = getFileMBR(job);//www .j a v a2s .com int imageWidth = getImageWidth(job); int imageHeight = getImageHeight(job); return new ImageRecordWriter(file, fs, imageWidth, imageHeight, fileMbr); }
From source file:com.tomslabs.grid.avro.TextTypedBytesToAvroOutputFormat.java
License:Apache License
public RecordWriter<TypedBytesWritable, TypedBytesWritable> getRecordWriter(FileSystem ignore, JobConf job, String name, Progressable prog) throws IOException { boolean isMapOnly = job.getNumReduceTasks() == 0; Schema schema = isMapOnly ? AvroJob.getMapOutputSchema(job) : AvroJob.getOutputSchema(job); final DataFileWriter<GenericRecord> writer = new DataFileWriter<GenericRecord>( new GenericDatumWriter<GenericRecord>(schema)); if (FileOutputFormat.getCompressOutput(job)) { int level = job.getInt(DEFLATE_LEVEL_KEY, DEFAULT_DEFLATE_LEVEL); writer.setCodec(CodecFactory.deflateCodec(level)); }/*from w w w .j a va 2s . c o m*/ // copy metadata from job for (Map.Entry<String, String> e : job) { if (e.getKey().startsWith(AvroJob.TEXT_PREFIX)) writer.setMeta(e.getKey().substring(AvroJob.TEXT_PREFIX.length()), e.getValue()); if (e.getKey().startsWith(AvroJob.BINARY_PREFIX)) writer.setMeta(e.getKey().substring(AvroJob.BINARY_PREFIX.length()), URLDecoder.decode(e.getValue(), "ISO-8859-1").getBytes("ISO-8859-1")); } Path path = FileOutputFormat.getTaskOutputPath(job, name + EXT); writer.create(schema, path.getFileSystem(job).create(path)); return new AvroRecordWriter(writer, schema); }
From source file:edu.ub.ahstfg.indexer.mapred.IndexOutputFormat.java
License:Open Source License
@Override public RecordWriter<Text, IndexRecord> getRecordWriter(FileSystem ignored, JobConf job, String name, Progressable progress) throws IOException { Path file = FileOutputFormat.getTaskOutputPath(job, name); FileSystem fs = file.getFileSystem(job); FSDataOutputStream fileOut = fs.create(file, progress); return new IndexRecordWriter(job, fileOut); }
From source file:edu.umn.cs.spatialHadoop.ImageOutputFormat.java
License:Apache License
@Override public RecordWriter<Rectangle, ImageWritable> getRecordWriter(FileSystem ignored, JobConf job, String name, Progressable progress) throws IOException { this.progress = progress; Path file = FileOutputFormat.getTaskOutputPath(job, name); FileSystem fs = file.getFileSystem(job); Rectangle fileMbr = getFileMBR(job); int imageWidth = getImageWidth(job); int imageHeight = getImageHeight(job); return new ImageRecordWriter(file, fs, imageWidth, imageHeight, fileMbr); }
From source file:edu.umn.cs.spatialHadoop.PyramidOutputFormat.java
License:Apache License
@Override public RecordWriter<TileIndex, ImageWritable> getRecordWriter(FileSystem ignored, JobConf job, String name, Progressable progress) throws IOException { this.progress = progress; Path file = FileOutputFormat.getTaskOutputPath(job, name); FileSystem fs = file.getFileSystem(job); return new ImageRecordWriter(file, fs); }
From source file:fm.last.feathers.output.IndexedPlainTypedBytes.java
License:Apache License
@Override public RecordWriter<TypedBytesWritable, TypedBytesWritable> getRecordWriter(FileSystem ignored, JobConf job, String name, Progressable progress) throws IOException { Path file = FileOutputFormat.getTaskOutputPath(job, name); Path index = file.suffix("-index"); FileSystem fs = file.getFileSystem(job); FSDataOutputStream fileOut = fs.create(file, progress); FSDataOutputStream indexOut = fs.create(index); return new IndexingPairWriter(fileOut, indexOut); }
From source file:fm.last.feathers.output.PlainTypedBytes.java
License:Apache License
public RecordWriter<TypedBytesWritable, TypedBytesWritable> getRecordWriter(FileSystem ignored, JobConf job, String name, Progressable progress) throws IOException { Path file = FileOutputFormat.getTaskOutputPath(job, name); FileSystem fs = file.getFileSystem(job); FSDataOutputStream fileOut = fs.create(file, progress); return new PairWriter(fileOut); }
From source file:fm.last.feathers.output.RawFileOutputFormat.java
License:Apache License
@Override public RecordWriter<K, V> getRecordWriter(FileSystem ignored, JobConf job, String name, Progressable progress) throws IOException { Path file = FileOutputFormat.getTaskOutputPath(job, name); FileSystem fs = file.getFileSystem(job); FSDataOutputStream fileOut = fs.create(file, progress); return new RawFileRecordWriter<K, V>(fileOut); }
From source file:IndexService.IndexIFormatOutputFormat.java
License:Open Source License
@Override public RecordWriter<IndexKey, IndexValue> getRecordWriter(FileSystem ignored, JobConf job, String name, Progressable progress) throws IOException { Path path = FileOutputFormat.getTaskOutputPath(job, name); String fileName = path.toString(); return new IndexIFormatOutputWriter<IndexKey, IndexValue>(fileName, job); }
From source file:IndexService.IndexMergeIFormatOutputFormat.java
License:Open Source License
@Override public RecordWriter<IndexKey, IndexValue> getRecordWriter(FileSystem ignored, JobConf job, String name, Progressable progress) throws IOException { Path path = FileOutputFormat.getTaskOutputPath(job, name); String fileName = path.toString(); return new IndexMergeIFormatWriter<IndexKey, IndexValue>(fileName, job); }