@Override public void close() throws IOException { reader.close(); }
@Override public synchronized float getProgress() throws IOException { if (start == end) { return 0.0f; } else { return Math.min(1.0f, (getFilePosition() - start) / (float)(end - start)); } }
@Override public synchronized long getPos() throws IOException { return reader.getPos(); }
@Override public synchronized boolean next(LongWritable key, BytesWritable value) throws IOException { boolean dataRead = reader.nextKeyValue(); if (dataRead) { LongWritable newKey = reader.getCurrentKey(); BytesWritable newValue = reader.getCurrentValue(); key.set(newKey.get()); value.set(newValue); } return dataRead; }
public FixedLengthRecordReader(Configuration job, FileSplit split, int recordLength) throws IOException { this.recordLength = recordLength; reader = new org.apache.hadoop.mapreduce.lib.input.FixedLengthRecordReader( recordLength); reader.initialize(job, split.getStart(), split.getLength(), split.getPath()); }
@Override public RecordReader<LongWritable, BytesWritable> createRecordReader(InputSplit split, TaskAttemptContext context) throws IOException, InterruptedException { int recordLength = getRecordLength(context.getConfiguration()); if (recordLength <= 0) { throw new IOException("Fixed record length " + recordLength + " is invalid. It should be set to a value greater than zero"); } return new FixedLengthRecordReader(recordLength); }
@Override public void initialize(InputSplit genericSplit, TaskAttemptContext context) throws IOException { FileSplit split = (FileSplit) genericSplit; Configuration job = context.getConfiguration(); final Path file = split.getPath(); initialize(job, split.getStart(), split.getLength(), file); }
@Override public float getProgress() throws IOException { return reader.getProgress(); }
@Override public synchronized boolean next(LongWritable key, BytesWritable value) throws IOException { boolean dataRead = reader.nextKeyValue(); if (dataRead) { LongWritable newKey = reader.getCurrentKey(); BytesWritable newValue = reader.getCurrentValue(); key.set(newKey.get()); value.set(newValue); } return dataRead; }
public FixedLengthRecordReader(Configuration job, FileSplit split, int recordLength) throws IOException { this.recordLength = recordLength; reader = new org.apache.hadoop.mapreduce.lib.input.FixedLengthRecordReader( recordLength); reader.initialize(job, split.getStart(), split.getLength(), split.getPath()); }
@Override public RecordReader<LongWritable, BytesWritable> createRecordReader(InputSplit split, TaskAttemptContext context) throws IOException, InterruptedException { int recordLength = getRecordLength(context.getConfiguration()); if (recordLength <= 0) { throw new IOException("Fixed record length " + recordLength + " is invalid. It should be set to a value greater than zero"); } return new FixedLengthRecordReader(recordLength); }
@Override public void initialize(InputSplit genericSplit, TaskAttemptContext context) throws IOException { FileSplit split = (FileSplit) genericSplit; Configuration job = context.getConfiguration(); final Path file = split.getPath(); initialize(job, split.getStart(), split.getLength(), file); }
@Override public float getProgress() throws IOException { return reader.getProgress(); }
@Override public synchronized boolean next(LongWritable key, BytesWritable value) throws IOException { boolean dataRead = reader.nextKeyValue(); if (dataRead) { LongWritable newKey = reader.getCurrentKey(); BytesWritable newValue = reader.getCurrentValue(); key.set(newKey.get()); value.set(newValue); } return dataRead; }
public FixedLengthRecordReader(Configuration job, FileSplit split, int recordLength) throws IOException { this.recordLength = recordLength; reader = new org.apache.hadoop.mapreduce.lib.input.FixedLengthRecordReader( recordLength); reader.initialize(job, split.getStart(), split.getLength(), split.getPath()); }
@Override public RecordReader<LongWritable, BytesWritable> createRecordReader(InputSplit split, TaskAttemptContext context) throws IOException, InterruptedException { int recordLength = getRecordLength(context.getConfiguration()); if (recordLength <= 0) { throw new IOException("Fixed record length " + recordLength + " is invalid. It should be set to a value greater than zero"); } return new FixedLengthRecordReader(recordLength); }
@Override public void initialize(InputSplit genericSplit, TaskAttemptContext context) throws IOException { FileSplit split = (FileSplit) genericSplit; Configuration job = context.getConfiguration(); final Path file = split.getPath(); initialize(job, split.getStart(), split.getLength(), file); }
@Override public synchronized float getProgress() throws IOException { if (start == end) { return 0.0f; } else { return Math.min(1.0f, (getFilePosition() - start) / (float)(end - start)); } }
@Override public synchronized long getPos() throws IOException { return reader.getPos(); }
@Override public void close() throws IOException { reader.close(); }