org.apache.pig.backend.hadoop.hbase
Class HBaseSlice

java.lang.Object
  extended by org.apache.pig.backend.hadoop.hbase.HBaseSlice
All Implemented Interfaces:
Serializable, Slice

public class HBaseSlice
extends Object
implements Slice

HBase Slice to load a portion of range of a table. The key range will be [start, end) Modeled from org.apache.hadoop.hbase.mapred.TableSplit.

See Also:
Serialized Form

Constructor Summary
HBaseSlice(byte[] tableName, byte[] startRow, byte[] endRow, byte[][] inputColumns, String location)
          Constructor
 
Method Summary
 void close()
          Closes any streams this Slice has opened as part of its work.
 byte[] getEndRow()
           
 byte[][] getInputColumns()
           
 long getLength()
          Returns the length in bytes of all of the data that will be processed by this Slice.
 String[] getLocations()
          Returns string representations of all the files that will be used as part of processing this Slice.
 long getPos()
          Returns the number of bytes read so far as part of processing this Slice.
 float getProgress()
          Returns the percentage of Slice that is complete from 0.0 to 1.0.
 String getRegionLocation()
           
 long getStart()
          Returns the offset from which data in this Slice will be processed.
 byte[] getStartRow()
           
 byte[] getTableName()
           
 void init(DataStorage store)
          Initializes this Slice with the DataStorage it's to use to do its work.
 boolean next(Tuple value)
          Loads the next value from this Slice into value.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HBaseSlice

public HBaseSlice(byte[] tableName,
                  byte[] startRow,
                  byte[] endRow,
                  byte[][] inputColumns,
                  String location)
Constructor

Parameters:
tableName - table name
startRow - start now, inclusive
endRow - end row, exclusive
inputColumns - input columns
location - region location
Method Detail

getTableName

public byte[] getTableName()
Returns:
table name

getStartRow

public byte[] getStartRow()
Returns:
starting row key

getEndRow

public byte[] getEndRow()
Returns:
end row key

getInputColumns

public byte[][] getInputColumns()
Returns:
input columns

getRegionLocation

public String getRegionLocation()
Returns:
the region's hostname

getStart

public long getStart()
Description copied from interface: Slice
Returns the offset from which data in this Slice will be processed.

Specified by:
getStart in interface Slice

getLength

public long getLength()
Description copied from interface: Slice
Returns the length in bytes of all of the data that will be processed by this Slice.

Only valid to call after Slice.init(DataStorage) has been called.

Specified by:
getLength in interface Slice

getLocations

public String[] getLocations()
Description copied from interface: Slice
Returns string representations of all the files that will be used as part of processing this Slice.

This is the only method on Slice that is valid to call before Slice.init(DataStorage) has been called.

Specified by:
getLocations in interface Slice

getPos

public long getPos()
            throws IOException
Description copied from interface: Slice
Returns the number of bytes read so far as part of processing this Slice.

Only valid to call after Slice.init(DataStorage) has been called.

Specified by:
getPos in interface Slice
Throws:
IOException

getProgress

public float getProgress()
                  throws IOException
Description copied from interface: Slice
Returns the percentage of Slice that is complete from 0.0 to 1.0.

Only valid to call after Slice.init(DataStorage) has been called.

Specified by:
getProgress in interface Slice
Throws:
IOException

init

public void init(DataStorage store)
          throws IOException
Description copied from interface: Slice
Initializes this Slice with the DataStorage it's to use to do its work.

This will always be called before getLength, close, getPos, getProgress and next.

Specified by:
init in interface Slice
Throws:
IOException

next

public boolean next(Tuple value)
             throws IOException
Description copied from interface: Slice
Loads the next value from this Slice into value.

Only valid to call after Slice.init(DataStorage) has been called.

Specified by:
next in interface Slice
Parameters:
value - - the Tuple to be filled with the next value.
Returns:
- true if there are more Tuples to be read.
Throws:
IOException

close

public void close()
           throws IOException
Description copied from interface: Slice
Closes any streams this Slice has opened as part of its work.

Only valid to call after Slice.init(DataStorage) has been called.

Specified by:
close in interface Slice
Throws:
IOException

toString

public String toString()
Overrides:
toString in class Object


Copyright © ${year} The Apache Software Foundation