org.apache.hadoop.util.Progressable Scala Examples
The following examples show how to use org.apache.hadoop.util.Progressable.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
Example 1
Source File: DeltaOutputFormat.scala From connectors with Apache License 2.0 | 5 votes |
package io.delta.hive import org.apache.hadoop.fs.FileSystem import org.apache.hadoop.io.{ArrayWritable, NullWritable} import org.apache.hadoop.mapred.{JobConf, OutputFormat, RecordWriter} import org.apache.hadoop.util.Progressable class DeltaOutputFormat extends OutputFormat[NullWritable, ArrayWritable] { private def writingNotSupported[T](): T = { throw new UnsupportedOperationException( "Writing to a Delta table in Hive is not supported. Please use Spark to write.") } override def getRecordWriter( ignored: FileSystem, job: JobConf, name: String, progress: Progressable): RecordWriter[NullWritable, ArrayWritable] = writingNotSupported() override def checkOutputSpecs(ignored: FileSystem, job: JobConf): Unit = writingNotSupported() }
Example 2
Source File: ByteArrayOutputFormat.scala From hail with MIT License | 5 votes |
package is.hail.io.hadoop import java.io.DataOutputStream import org.apache.hadoop.fs._ import org.apache.hadoop.io._ import org.apache.hadoop.mapred._ import org.apache.hadoop.util.Progressable class ByteArrayOutputFormat extends FileOutputFormat[NullWritable, BytesOnlyWritable] { class ByteArrayRecordWriter(out: DataOutputStream) extends RecordWriter[NullWritable, BytesOnlyWritable] { def write(key: NullWritable, value: BytesOnlyWritable) { if (value != null) value.write(out) } def close(reporter: Reporter) { out.close() } } override def getRecordWriter(ignored: FileSystem, job: JobConf, name: String, progress: Progressable): RecordWriter[NullWritable, BytesOnlyWritable] = { val file: Path = FileOutputFormat.getTaskOutputPath(job, name) val fs: FileSystem = file.getFileSystem(job) val fileOut: FSDataOutputStream = fs.create(file, progress) new ByteArrayRecordWriter(fileOut) } }