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

@InterfaceAudience.Public
@InterfaceStability.Evolving
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) and an optional scanner. All references to row below refer to the key of the row.


Field Summary
static org.apache.commons.logging.Log LOG
           
 
Constructor Summary
TableSplit()
          Default constructor.
TableSplit(byte[] tableName, byte[] startRow, byte[] endRow, String location)
          Deprecated. Since 0.96.0; use TableSplit(TableName, byte[], byte[], String)
TableSplit(byte[] tableName, Scan scan, byte[] startRow, byte[] endRow, String location)
          Deprecated. Since 0.96.0; use TableSplit(TableName, byte[], byte[], String)
TableSplit(TableName tableName, byte[] startRow, byte[] endRow, String location)
          Creates a new instance without a scanner.
TableSplit(TableName tableName, byte[] startRow, byte[] endRow, String location, long length)
          Creates a new instance without a scanner.
TableSplit(TableName tableName, Scan scan, byte[] startRow, byte[] endRow, String location)
          Creates a new instance while assigning all variables.
TableSplit(TableName tableName, Scan scan, byte[] startRow, byte[] endRow, String location, long length)
          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.
 Scan getScan()
          Returns a Scan object from the stored string representation.
 byte[] getStartRow()
          Returns the start row.
 TableName getTable()
          Returns the table name.
 byte[] getTableName()
          Returns the table name converted to a byte array.
 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
 

Field Detail

LOG

public static final org.apache.commons.logging.Log LOG
Constructor Detail

TableSplit

public TableSplit()
Default constructor.


TableSplit

@Deprecated
public TableSplit(byte[] tableName,
                             Scan scan,
                             byte[] startRow,
                             byte[] endRow,
                             String location)
Deprecated. Since 0.96.0; use TableSplit(TableName, byte[], byte[], String)


TableSplit

public TableSplit(TableName tableName,
                  Scan scan,
                  byte[] startRow,
                  byte[] endRow,
                  String location)
Creates a new instance while assigning all variables. Length of region is set to 0

Parameters:
tableName - The name of the current table.
scan - The scan associated with this split.
startRow - The start row of the split.
endRow - The end row of the split.
location - The location of the region.

TableSplit

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

Parameters:
tableName - The name of the current table.
scan - The scan associated with this split.
startRow - The start row of the split.
endRow - The end row of the split.
location - The location of the region.

TableSplit

@Deprecated
public TableSplit(byte[] tableName,
                             byte[] startRow,
                             byte[] endRow,
                             String location)
Deprecated. Since 0.96.0; use TableSplit(TableName, byte[], byte[], String)


TableSplit

public TableSplit(TableName tableName,
                  byte[] startRow,
                  byte[] endRow,
                  String location)
Creates a new instance without a scanner.

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.

TableSplit

public TableSplit(TableName tableName,
                  byte[] startRow,
                  byte[] endRow,
                  String location,
                  long length)
Creates a new instance without a scanner.

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.
length - Size of region in bytes
Method Detail

getScan

public Scan getScan()
             throws IOException
Returns a Scan object from the stored string representation.

Returns:
Returns a Scan object based on the stored scanner.
Throws:
IOException

getTableName

public byte[] getTableName()
Returns the table name converted to a byte array.

Returns:
The table name.
See Also:
getTable()

getTable

public TableName getTable()
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 © 2015 The Apache Software Foundation. All rights reserved.