org.apache.hadoop.hive.ql.io
Class FlatFileInputFormat.FlatFileRecordReader<R>

java.lang.Object
  extended by org.apache.hadoop.hive.ql.io.FlatFileInputFormat.FlatFileRecordReader<R>
All Implemented Interfaces:
org.apache.hadoop.mapred.RecordReader<Void,FlatFileInputFormat.RowContainer<R>>
Enclosing class:
FlatFileInputFormat<T>

public class FlatFileInputFormat.FlatFileRecordReader<R>
extends Object
implements org.apache.hadoop.mapred.RecordReader<Void,FlatFileInputFormat.RowContainer<R>>

An RecordReader for plain files with Deserializer records Reads one row at a time of type R. R is intended to be a base class of something such as: Record, Writable, Text, ...


Field Summary
static String SerializationContextImplKey
          The JobConf key of the SerializationContext to use.
 
Constructor Summary
FlatFileInputFormat.FlatFileRecordReader(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.mapred.FileSplit split)
          FlatFileRecordReader constructor constructs the underlying stream (potentially decompressed) and creates the deserializer.
 
Method Summary
 void close()
           
 Void createKey()
           
 FlatFileInputFormat.RowContainer<R> createValue()
           
 long getPos()
           
 float getProgress()
           
 boolean next(Void key, FlatFileInputFormat.RowContainer<R> value)
          Returns the next row # and value.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SerializationContextImplKey

public static final String SerializationContextImplKey
The JobConf key of the SerializationContext to use.

See Also:
Constant Field Values
Constructor Detail

FlatFileInputFormat.FlatFileRecordReader

public FlatFileInputFormat.FlatFileRecordReader(org.apache.hadoop.conf.Configuration conf,
                                                org.apache.hadoop.mapred.FileSplit split)
                                         throws IOException
FlatFileRecordReader constructor constructs the underlying stream (potentially decompressed) and creates the deserializer.

Parameters:
conf - the jobconf
split - the split for this file
Throws:
IOException
Method Detail

createKey

public Void createKey()
Specified by:
createKey in interface org.apache.hadoop.mapred.RecordReader<Void,FlatFileInputFormat.RowContainer<R>>
Returns:
null

createValue

public FlatFileInputFormat.RowContainer<R> createValue()
Specified by:
createValue in interface org.apache.hadoop.mapred.RecordReader<Void,FlatFileInputFormat.RowContainer<R>>
Returns:
a new R instance.

next

public boolean next(Void key,
                    FlatFileInputFormat.RowContainer<R> value)
             throws IOException
Returns the next row # and value.

Specified by:
next in interface org.apache.hadoop.mapred.RecordReader<Void,FlatFileInputFormat.RowContainer<R>>
Parameters:
key - - void as these files have a value only
value - - the row container which is always re-used, but the internal value may be set to a new Object
Returns:
whether the key and value were read. True if they were and false if EOF
Throws:
IOException - from the deserializer

getProgress

public float getProgress()
                  throws IOException
Specified by:
getProgress in interface org.apache.hadoop.mapred.RecordReader<Void,FlatFileInputFormat.RowContainer<R>>
Throws:
IOException

getPos

public long getPos()
            throws IOException
Specified by:
getPos in interface org.apache.hadoop.mapred.RecordReader<Void,FlatFileInputFormat.RowContainer<R>>
Throws:
IOException

close

public void close()
           throws IOException
Specified by:
close in interface org.apache.hadoop.mapred.RecordReader<Void,FlatFileInputFormat.RowContainer<R>>
Throws:
IOException


Copyright © 2014 The Apache Software Foundation. All rights reserved.