本文整理汇总了Scala中org.apache.hadoop.mapreduce.RecordWriter类的典型用法代码示例。如果您正苦于以下问题:Scala RecordWriter类的具体用法?Scala RecordWriter怎么用?Scala RecordWriter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RecordWriter类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Scala代码示例。
示例1: SuccinctAnnotationOutputFormat
//设置package包名称以及导入依赖的类
package edu.berkeley.cs.succinct.annot.serde
import java.io.File
import org.apache.hadoop.io.NullWritable
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat
import org.apache.hadoop.mapreduce.{RecordWriter, TaskAttemptContext}
class SuccinctAnnotationOutputFormat
extends FileOutputFormat[NullWritable, (Int, Iterator[(String, String, String)])] {
override def getRecordWriter(job: TaskAttemptContext):
RecordWriter[NullWritable, (Int, Iterator[(String, String, String)])] = {
val conf = job.getConfiguration
val ignoreParseErrors = conf.get("succinct.annotations.ignoreParseErrors", "true").toBoolean
val serializeInMemory = conf.get("succinct.annotations.serializeInMemory", "true").toBoolean
val dirs = conf.get("spark.local.dir", System.getProperty("java.io.tmpdir")).split(",")
println("ignoreParseErrors = " + ignoreParseErrors + " serializeInMemory = " + serializeInMemory
+ "Spark local dir = " + dirs(0) + " persistInMemory = false")
val path = FileOutputFormat.getOutputPath(job)
new SuccinctAnnotationRecordWriter(path, ignoreParseErrors, conf, (serializeInMemory, new File(dirs(0))))
}
}