org.apache.hadoop.hbase.mapreduce
Class TableSplit

java.lang.Object
  extended by org.apache.hadoop.mapreduce.InputSplit
      extended by org.apache.hadoop.hbase.mapreduce.TableSplit
All Implemented Interfaces:
Comparable<TableSplit>, org.apache.hadoop.io.Writable

public class TableSplit
extends org.apache.hadoop.mapreduce.InputSplit
implements org.apache.hadoop.io.Writable, Comparable<TableSplit>

A table split corresponds to a key range (low, high). All references to row below refer to the key of the row.


Constructor Summary
TableSplit()
          Default constructor.
TableSplit(byte[] tableName, byte[] startRow, byte[] endRow, String location)
          Creates a new instance while assigning all variables.
 
Method Summary
 int compareTo(TableSplit split)
          Compares this split against the given one.
 boolean equals(Object o)
           
 byte[] getEndRow()
          Returns the end row.
 long getLength()
          Returns the length of the split.
 String[] getLocations()
          Returns the region's location as an array.
 String getRegionLocation()
          Returns the region location.
 byte[] getStartRow()
          Returns the start row.
 byte[] getTableName()
          Returns the table name.
 int hashCode()
           
 void readFields(DataInput in)
          Reads the values of each field.
 String toString()
          Returns the details about this instance as a string.
 void write(DataOutput out)
          Writes the field values to the output.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TableSplit

public TableSplit()
Default constructor.


TableSplit

public TableSplit(byte[] tableName,
                  byte[] startRow,
                  byte[] endRow,
                  String location)
Creates a new instance while assigning all variables.

Parameters:
tableName - The name of the current table.
startRow - The start row of the split.
endRow - The end row of the split.
location - The location of the region.
Method Detail

getTableName

public byte[] getTableName()
Returns the table name.

Returns:
The table name.

getStartRow

public byte[] getStartRow()
Returns the start row.

Returns:
The start row.

getEndRow

public byte[] getEndRow()
Returns the end row.

Returns:
The end row.

getRegionLocation

public String getRegionLocation()
Returns the region location.

Returns:
The region's location.

getLocations

public String[] getLocations()
Returns the region's location as an array.

Specified by:
getLocations in class org.apache.hadoop.mapreduce.InputSplit
Returns:
The array containing the region location.
See Also:
InputSplit.getLocations()

getLength

public long getLength()
Returns the length of the split.

Specified by:
getLength in class org.apache.hadoop.mapreduce.InputSplit
Returns:
The length of the split.
See Also:
InputSplit.getLength()

readFields

public void readFields(DataInput in)
                throws IOException
Reads the values of each field.

Specified by:
readFields in interface org.apache.hadoop.io.Writable
Parameters:
in - The input to read from.
Throws:
IOException - When reading the input fails.

write

public void write(DataOutput out)
           throws IOException
Writes the field values to the output.

Specified by:
write in interface org.apache.hadoop.io.Writable
Parameters:
out - The output to write to.
Throws:
IOException - When writing the values to the output fails.

toString

public String toString()
Returns the details about this instance as a string.

Overrides:
toString in class Object
Returns:
The values of this instance as a string.
See Also:
Object.toString()

compareTo

public int compareTo(TableSplit split)
Compares this split against the given one.

Specified by:
compareTo in interface Comparable<TableSplit>
Parameters:
split - The split to compare to.
Returns:
The result of the comparison.
See Also:
Comparable.compareTo(java.lang.Object)

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2011 The Apache Software Foundation. All Rights Reserved.