public static class RCFile.Reader
extends java.lang.Object
Constructor and Description |
---|
Reader(FileSystem fs,
Path file,
Configuration conf)
Create a new RCFile reader.
|
Reader(FileSystem fs,
Path file,
int bufferSize,
Configuration conf,
long start,
long length)
Create a new RCFile reader.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the reader.
|
protected void |
currentValueBuffer() |
BytesRefArrayWritable |
getColumn(int columnID,
BytesRefArrayWritable rest)
Fetch all data in the buffer for a given column.
|
CompressionCodec |
getCompressionCodec() |
int |
getCurrentBlockLength() |
int |
getCurrentCompressedKeyLen() |
RCFile.KeyBuffer |
getCurrentKeyBufferObj()
return the KeyBuffer object used in the reader.
|
int |
getCurrentKeyLength() |
void |
getCurrentRow(BytesRefArrayWritable ret)
get the current row used,make sure called
next(LongWritable)
first. |
RCFile.ValueBuffer |
getCurrentValueBufferObj()
return the ValueBuffer object used in the reader.
|
Metadata |
getMetadata()
Return the metadata (Text to Text map) that was written into the
file.
|
Text |
getMetadataValueOf(Text key)
Return the metadata value associated with the given key.
|
long |
getPosition()
Return the current byte position in the input file.
|
boolean |
hasRecordsInBuffer() |
boolean |
isCompressedRCFile() |
long |
lastSeenSyncPos()
Returns the last seen sync position.
|
boolean |
next(LongWritable readRows)
Returns how many rows we fetched with next().
|
boolean |
nextBlock() |
boolean |
nextColumnsBatch()
Deprecated.
|
protected int |
nextKeyBuffer() |
protected FSDataInputStream |
openFile(FileSystem fs,
Path file,
int bufferSize,
long length)
Override this method to specialize the type of
FSDataInputStream returned. |
void |
resetBuffer()
Resets the values which determine if there are more rows in the buffer
This can be used after one calls seek or sync, if one called next before that.
|
void |
seek(long position)
Set the current byte position in the input file.
|
void |
sync(long position)
Seek to the next sync mark past a given position.
|
boolean |
syncSeen()
Returns true iff the previous call to next passed a sync mark.
|
java.lang.String |
toString()
Returns the name of the file.
|
public Reader(FileSystem fs, Path file, Configuration conf) throws java.io.IOException
java.io.IOException
public Reader(FileSystem fs, Path file, int bufferSize, Configuration conf, long start, long length) throws java.io.IOException
java.io.IOException
public Metadata getMetadata()
public Text getMetadataValueOf(Text key)
key
- the metadata key to retrieveprotected FSDataInputStream openFile(FileSystem fs, Path file, int bufferSize, long length) throws java.io.IOException
FSDataInputStream
returned.java.io.IOException
public long getPosition() throws java.io.IOException
java.io.IOException
public void seek(long position) throws java.io.IOException
The position passed must be a position returned by
RCFile.Writer.getLength()
when writing this file. To seek to an
arbitrary position, use sync(long)
. In another
words, the current seek can only seek to the end of the file. For other
positions, use sync(long)
.
java.io.IOException
public void resetBuffer()
public void sync(long position) throws java.io.IOException
java.io.IOException
protected int nextKeyBuffer() throws java.io.IOException
java.io.IOException
protected void currentValueBuffer() throws java.io.IOException
java.io.IOException
public boolean nextBlock() throws java.io.IOException
java.io.IOException
public BytesRefArrayWritable getColumn(int columnID, BytesRefArrayWritable rest) throws java.io.IOException
nextColumnsBatch()
.
Calling getColumn() with not change the result of
next(LongWritable)
and
getCurrentRow(BytesRefArrayWritable)
.columnID
- the number of the column to get 0 to N-1java.io.IOException
@Deprecated public boolean nextColumnsBatch() throws java.io.IOException
next(LongWritable)
and
getCurrentRow(BytesRefArrayWritable)
java.io.IOException
public boolean next(LongWritable readRows) throws java.io.IOException
seek(long)
,
nextColumnsBatch()
can change the underlying key buffer and
value buffer.java.io.IOException
public boolean hasRecordsInBuffer()
public void getCurrentRow(BytesRefArrayWritable ret) throws java.io.IOException
next(LongWritable)
first.java.io.IOException
public boolean syncSeen()
public long lastSeenSyncPos()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean isCompressedRCFile()
public void close()
public RCFile.KeyBuffer getCurrentKeyBufferObj()
public RCFile.ValueBuffer getCurrentValueBufferObj()
public int getCurrentBlockLength()
public int getCurrentKeyLength()
public int getCurrentCompressedKeyLen()
public CompressionCodec getCompressionCodec()
Copyright © 2012 The Apache Software Foundation