org.apache.hadoop.zebra.io
Interface TableScanner

All Superinterfaces:
Closeable

public interface TableScanner
extends Closeable

Scanner interface allows application to scan a range of rows of a table. It is the caller's responsibility to close() the scanner after finishing using it. Scanner allows one to fetch the key without fetching the value to allow underlying implementation to instantiating tuple objects (Row) lazily.


Method Summary
 boolean advance()
          Advance cursor to the next Row.
 boolean atEnd()
          Test whether the cursor is at the end of the scan range.
 void getKey(org.apache.hadoop.io.BytesWritable key)
          Get the row key.
 String getProjection()
           
 Schema getSchema()
          Get the projection's schema
 void getValue(Tuple row)
          Get the row.
 boolean seekTo(org.apache.hadoop.io.BytesWritable key)
          Seek to the key that is greater or equal to the provided key, or we reach the end.
 void seekToEnd()
          Seek to the end of the scan range.
 
Methods inherited from interface java.io.Closeable
close
 

Method Detail

atEnd

boolean atEnd()
              throws IOException
Test whether the cursor is at the end of the scan range.

Returns:
Whether the cursor is at the end of the scan range.
Throws:
IOException

advance

boolean advance()
                throws IOException
Advance cursor to the next Row.

Returns:
true if the cursor is moved. It will return true when the scanner moves the cursor from the last row to the end position.
Throws:
IOException

getKey

void getKey(org.apache.hadoop.io.BytesWritable key)
            throws IOException
Get the row key.

Parameters:
key - The output parameter to hold the result.
Throws:
IOException

getValue

void getValue(Tuple row)
              throws IOException
Get the row.

Parameters:
row - The output parameter to hold the result. It must conform to the schema that the scanner is aware of.
Throws:
IOException
See Also:
getSchema()

seekTo

boolean seekTo(org.apache.hadoop.io.BytesWritable key)
               throws IOException
Seek to the key that is greater or equal to the provided key, or we reach the end. It is only applicable to sorted tables.

Parameters:
key - The input key.
Returns:
true if we find the exact match; false otherwise.
Throws:
IOException

seekToEnd

void seekToEnd()
               throws IOException
Seek to the end of the scan range.

Throws:
IOException

getProjection

String getProjection()

getSchema

Schema getSchema()
Get the projection's schema



Copyright © 2012 The Apache Software Foundation