Skip to content
Snippets Groups Projects
Commit dd68cb60 authored by Cliff Engle's avatar Cliff Engle
Browse files

Get key and value container from RecordReader

parent 1e10df0a
No related branches found
No related tags found
No related merge requests found
......@@ -60,18 +60,6 @@ class HadoopRDD[K, V](
.asInstanceOf[InputFormat[K, V]]
}
/**
* Helper method for creating a Hadoop Writable, because the commonly used NullWritable class has
* no constructor.
*/
def createWritable[T](clazz: Class[T]): T = {
if (clazz == classOf[NullWritable]) {
NullWritable.get().asInstanceOf[T]
} else {
clazz.newInstance()
}
}
override def splits = splits_
override def compute(theSplit: Split) = new Iterator[(K, V)] {
......@@ -82,8 +70,8 @@ class HadoopRDD[K, V](
val fmt = createInputFormat(conf)
reader = fmt.getRecordReader(split.inputSplit.value, conf, Reporter.NULL)
val key: K = createWritable(keyClass)
val value: V = createWritable(valueClass)
val key: K = reader.createKey()
val value: V = reader.createValue()
var gotNext = false
var finished = false
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment