Skip to content

Commit

Permalink
fixing line lengths, adding new lines
Browse files Browse the repository at this point in the history
  • Loading branch information
kmader committed Aug 13, 2014
1 parent f4841dc commit edf5829
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ import org.apache.hadoop.mapreduce.lib.input.FileInputFormat
import org.apache.hadoop.mapreduce.{InputSplit, JobContext, RecordReader, TaskAttemptContext}

/**
* Custom Input Format for reading and splitting flat binary files that contain records, each of which
* are a fixed size in bytes. The fixed record size is specified through a parameter recordLength
* in the Hadoop configuration.
* Custom Input Format for reading and splitting flat binary files that contain records,
* each of which are a fixed size in bytes. The fixed record size is specified through
* a parameter recordLength in the Hadoop configuration.
*/

object FixedLengthBinaryInputFormat {
Expand Down Expand Up @@ -92,4 +92,4 @@ class FixedLengthBinaryInputFormat extends FileInputFormat[LongWritable, BytesWr

var recordLength = -1

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ class FixedLengthBinaryRecordReader extends RecordReader[LongWritable, BytesWrit
override def getProgress: Float = {
splitStart match {
case x if x == splitEnd => 0.0.toFloat
case _ => Math.min(((currentPosition - splitStart) / (splitEnd - splitStart)).toFloat, 1.0).toFloat
case _ => Math.min(
((currentPosition - splitStart) / (splitEnd - splitStart)).toFloat, 1.0
).toFloat
}
}

Expand Down Expand Up @@ -141,4 +143,4 @@ class FixedLengthBinaryRecordReader extends RecordReader[LongWritable, BytesWrit
var recordKey: LongWritable = null
var recordValue: BytesWritable = null

}
}

0 comments on commit edf5829

Please sign in to comment.