|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hbase.client.HTable
public class HTable
Used to communicate with a single HBase table
Nested Class Summary | |
---|---|
protected class |
HTable.ClientScanner
Implements the scanner interface for the HBase client. |
Constructor Summary | |
---|---|
HTable(byte[] tableName)
Creates an object to access a HBase table |
|
HTable(HBaseConfiguration conf,
byte[] tableName)
Creates an object to access a HBase table |
|
HTable(HBaseConfiguration conf,
String tableName)
Creates an object to access a HBase table |
|
HTable(String tableName)
Creates an object to access a HBase table |
Method Summary | |
---|---|
void |
commit(BatchUpdate batchUpdate)
Commit a BatchUpdate to the table. |
void |
commit(BatchUpdate batchUpdate,
RowLock rl)
Commit a BatchUpdate to the table using existing row lock. |
void |
commit(List<BatchUpdate> batchUpdates)
Commit a RowsBatchUpdate to the table. |
void |
deleteAll(byte[] row)
Completely delete the row's cells. |
void |
deleteAll(byte[] row,
byte[] column)
Completely delete the row's cells. |
void |
deleteAll(byte[] row,
byte[] column,
long ts)
Delete all cells that match the passed row and column and whose timestamp is equal-to or older than the passed timestamp. |
void |
deleteAll(byte[] row,
byte[] column,
long ts,
RowLock rl)
Delete all cells that match the passed row and column and whose timestamp is equal-to or older than the passed timestamp, using an existing row lock. |
void |
deleteAll(byte[] row,
long ts)
Completely delete the row's cells. |
void |
deleteAll(String row)
Completely delete the row's cells. |
void |
deleteAll(String row,
long ts)
Completely delete the row's cells. |
void |
deleteAll(String row,
String column)
Delete all cells that match the passed row and column. |
void |
deleteAll(String row,
String column,
long ts)
Delete all cells that match the passed row and column and whose timestamp is equal-to or older than the passed timestamp. |
void |
deleteFamily(byte[] row,
byte[] family)
Delete all cells for a row with matching column family at all timestamps. |
void |
deleteFamily(byte[] row,
byte[] family,
long timestamp)
Delete all cells for a row with matching column family with timestamps less than or equal to timestamp. |
void |
deleteFamily(byte[] row,
byte[] family,
long timestamp,
RowLock rl)
Delete all cells for a row with matching column family with timestamps less than or equal to timestamp, using existing row lock. |
void |
deleteFamily(String row,
String family)
Delete all cells for a row with matching column family at all timestamps. |
void |
deleteFamily(String row,
String family,
long timestamp)
Delete all cells for a row with matching column family with timestamps less than or equal to timestamp. |
Cell |
get(byte[] row,
byte[] column)
Get a single value for the specified row and column |
Cell[] |
get(byte[] row,
byte[] column,
int numVersions)
Get the specified number of versions of the specified row and column |
Cell[] |
get(byte[] row,
byte[] column,
long timestamp,
int numVersions)
Get the specified number of versions of the specified row and column with the specified timestamp. |
Cell |
get(String row,
String column)
Get a single value for the specified row and column |
Cell[] |
get(String row,
String column,
int numVersions)
Get a single value for the specified row and column |
Cell[] |
get(String row,
String column,
long timestamp,
int numVersions)
Get the specified number of versions of the specified row and column with the specified timestamp. |
HConnection |
getConnection()
Used by unit tests and tools to do low-level manipulations. |
HRegionLocation |
getRegionLocation(byte[] row)
Find region location hosting passed row using cached info |
HRegionLocation |
getRegionLocation(String row)
Find region location hosting passed row using cached info |
Map<HRegionInfo,HServerAddress> |
getRegionsInfo()
Get all the regions and their address for this table |
RowResult |
getRow(byte[] row)
Get all the data for the specified row at the latest timestamp |
RowResult |
getRow(byte[] row,
byte[][] columns)
Get selected columns for the specified row at the latest timestamp |
RowResult |
getRow(byte[] row,
byte[][] columns,
long ts)
Get selected columns for the specified row at a specified timestamp |
RowResult |
getRow(byte[] row,
byte[][] columns,
long ts,
RowLock rl)
Get selected columns for the specified row at a specified timestamp using existing row lock. |
RowResult |
getRow(byte[] row,
long ts)
Get all the data for the specified row at a specified timestamp |
RowResult |
getRow(String row)
Get all the data for the specified row at the latest timestamp |
RowResult |
getRow(String row,
long ts)
Get all the data for the specified row at a specified timestamp |
RowResult |
getRow(String row,
String[] columns)
Get selected columns for the specified row at the latest timestamp |
RowResult |
getRow(String row,
String[] columns,
long ts)
Get selected columns for the specified row at a specified timestamp |
Scanner |
getScanner(byte[][] columns)
Get a scanner on the current table starting at first row. |
Scanner |
getScanner(byte[][] columns,
byte[] startRow)
Get a scanner on the current table starting at the specified row. |
Scanner |
getScanner(byte[][] columns,
byte[] startRow,
byte[] stopRow)
Get a scanner on the current table starting at the specified row and ending just before stopRow |
Scanner |
getScanner(byte[][] columns,
byte[] startRow,
byte[] stopRow,
long timestamp)
Get a scanner on the current table starting at the specified row and ending just before stopRow |
Scanner |
getScanner(byte[][] columns,
byte[] startRow,
long timestamp)
Get a scanner on the current table starting at the specified row. |
Scanner |
getScanner(byte[][] columns,
byte[] startRow,
long timestamp,
RowFilterInterface filter)
Get a scanner on the current table starting at the specified row. |
Scanner |
getScanner(byte[][] columns,
byte[] startRow,
RowFilterInterface filter)
Get a scanner on the current table starting at the specified row. |
Scanner |
getScanner(String[] columns)
Get a scanner on the current table starting at first row. |
Scanner |
getScanner(String[] columns,
String startRow)
Get a scanner on the current table starting at the specified row. |
Scanner |
getScanner(String[] columns,
String startRow,
long timestamp,
RowFilterInterface filter)
Get a scanner on the current table starting at the specified row. |
Scanner |
getScanner(String[] columns,
String startRow,
String stopRow,
long timestamp)
Get a scanner on the current table starting at the specified row and ending just before stopRow |
byte[][] |
getStartKeys()
Gets the starting row key for every region in the currently open table |
HTableDescriptor |
getTableDescriptor()
|
byte[] |
getTableName()
|
static boolean |
isTableEnabled(byte[] tableName)
|
static boolean |
isTableEnabled(HBaseConfiguration conf,
byte[] tableName)
|
static boolean |
isTableEnabled(HBaseConfiguration conf,
String tableName)
|
static boolean |
isTableEnabled(String tableName)
|
RowLock |
lockRow(byte[] row)
Obtain a row lock |
void |
unlockRow(RowLock rl)
Release a row lock |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HTable(String tableName) throws IOException
tableName
- name of the table
IOException
public HTable(byte[] tableName) throws IOException
tableName
- name of the table
IOException
public HTable(HBaseConfiguration conf, String tableName) throws IOException
conf
- configuration objecttableName
- name of the table
IOException
public HTable(HBaseConfiguration conf, byte[] tableName) throws IOException
conf
- configuration objecttableName
- name of the table
IOException
Method Detail |
---|
public static boolean isTableEnabled(String tableName) throws IOException
tableName
- name of table to check
IOException
public static boolean isTableEnabled(byte[] tableName) throws IOException
tableName
- name of table to check
IOException
public static boolean isTableEnabled(HBaseConfiguration conf, String tableName) throws IOException
conf
- HBaseConfiguration objecttableName
- name of table to check
IOException
public static boolean isTableEnabled(HBaseConfiguration conf, byte[] tableName) throws IOException
conf
- HBaseConfiguration objecttableName
- name of table to check
IOException
public HRegionLocation getRegionLocation(String row) throws IOException
row
- Row to find.
IOException
public HRegionLocation getRegionLocation(byte[] row) throws IOException
row
- Row to find.
IOException
public byte[] getTableName()
public HConnection getConnection()
public HTableDescriptor getTableDescriptor() throws IOException
IOException
public byte[][] getStartKeys() throws IOException
IOException
public Map<HRegionInfo,HServerAddress> getRegionsInfo() throws IOException
IOException
public Cell get(String row, String column) throws IOException
row
- row keycolumn
- column name
IOException
public Cell[] get(String row, String column, int numVersions) throws IOException
row
- row keycolumn
- column namenumVersions
- - number of versions to retrieve
IOException
public Cell get(byte[] row, byte[] column) throws IOException
row
- row keycolumn
- column name
IOException
public Cell[] get(byte[] row, byte[] column, int numVersions) throws IOException
row
- row keycolumn
- column namenumVersions
- number of versions to retrieve
IOException
public Cell[] get(String row, String column, long timestamp, int numVersions) throws IOException
row
- - row keycolumn
- - column nametimestamp
- - timestampnumVersions
- - number of versions to retrieve
IOException
public Cell[] get(byte[] row, byte[] column, long timestamp, int numVersions) throws IOException
row
- - row keycolumn
- - column nametimestamp
- - timestampnumVersions
- - number of versions to retrieve
IOException
public RowResult getRow(String row) throws IOException
row
- row key
IOException
public RowResult getRow(byte[] row) throws IOException
row
- row key
IOException
public RowResult getRow(String row, long ts) throws IOException
row
- row keyts
- timestamp
IOException
public RowResult getRow(byte[] row, long ts) throws IOException
row
- row keyts
- timestamp
IOException
public RowResult getRow(String row, String[] columns) throws IOException
row
- row keycolumns
- Array of column names and families you want to retrieve.
IOException
public RowResult getRow(byte[] row, byte[][] columns) throws IOException
row
- row keycolumns
- Array of column names and families you want to retrieve.
IOException
public RowResult getRow(String row, String[] columns, long ts) throws IOException
row
- row keycolumns
- Array of column names and families you want to retrieve.ts
- timestamp
IOException
public RowResult getRow(byte[] row, byte[][] columns, long ts) throws IOException
row
- row keycolumns
- Array of column names and families you want to retrieve.ts
- timestamp
IOException
public RowResult getRow(byte[] row, byte[][] columns, long ts, RowLock rl) throws IOException
row
- row keycolumns
- Array of column names and families you want to retrieve.ts
- timestamprl
- row lock
IOException
public Scanner getScanner(String[] columns) throws IOException
columns
- columns to scan. If column name is a column family, all
columns of the specified column family are returned. Its also possible
to pass a regex in the column qualifier. A column qualifier is judged to
be a regex if it contains at least one of the following characters:
\+|^&*$[]]}{)(
.
IOException
public Scanner getScanner(String[] columns, String startRow) throws IOException
columns
- columns to scan. If column name is a column family, all
columns of the specified column family are returned. Its also possible
to pass a regex in the column qualifier. A column qualifier is judged to
be a regex if it contains at least one of the following characters:
\+|^&*$[]]}{)(
.startRow
- starting row in table to scan
IOException
public Scanner getScanner(byte[][] columns) throws IOException
columns
- columns to scan. If column name is a column family, all
columns of the specified column family are returned. Its also possible
to pass a regex in the column qualifier. A column qualifier is judged to
be a regex if it contains at least one of the following characters:
\+|^&*$[]]}{)(
.
IOException
public Scanner getScanner(byte[][] columns, byte[] startRow) throws IOException
columns
- columns to scan. If column name is a column family, all
columns of the specified column family are returned. Its also possible
to pass a regex in the column qualifier. A column qualifier is judged to
be a regex if it contains at least one of the following characters:
\+|^&*$[]]}{)(
.startRow
- starting row in table to scan
IOException
public Scanner getScanner(byte[][] columns, byte[] startRow, long timestamp) throws IOException
columns
- columns to scan. If column name is a column family, all
columns of the specified column family are returned. Its also possible
to pass a regex in the column qualifier. A column qualifier is judged to
be a regex if it contains at least one of the following characters:
\+|^&*$[]]}{)(
.startRow
- starting row in table to scantimestamp
- only return results whose timestamp <= this value
IOException
public Scanner getScanner(byte[][] columns, byte[] startRow, RowFilterInterface filter) throws IOException
columns
- columns to scan. If column name is a column family, all
columns of the specified column family are returned. Its also possible
to pass a regex in the column qualifier. A column qualifier is judged to
be a regex if it contains at least one of the following characters:
\+|^&*$[]]}{)(
.startRow
- starting row in table to scanfilter
- a row filter using row-key regexp and/or column data filter.
IOException
public Scanner getScanner(byte[][] columns, byte[] startRow, byte[] stopRow) throws IOException
stopRow.
Return the specified columns.
- Parameters:
columns
- columns to scan. If column name is a column family, all
columns of the specified column family are returned. Its also possible
to pass a regex in the column qualifier. A column qualifier is judged to
be a regex if it contains at least one of the following characters:
\+|^&*$[]]}{)(
.startRow
- starting row in table to scanstopRow
- Row to stop scanning on. Once we hit this row we stop
returning values; i.e. we return the row before this one but not the
stopRow
itself.
- Returns:
- scanner
- Throws:
IOException
public Scanner getScanner(String[] columns, String startRow, String stopRow, long timestamp) throws IOException
stopRow.
Return the specified columns.
- Parameters:
columns
- columns to scan. If column name is a column family, all
columns of the specified column family are returned. Its also possible
to pass a regex in the column qualifier. A column qualifier is judged to
be a regex if it contains at least one of the following characters:
\+|^&*$[]]}{)(
.startRow
- starting row in table to scanstopRow
- Row to stop scanning on. Once we hit this row we stop
returning values; i.e. we return the row before this one but not the
stopRow
itself.timestamp
- only return results whose timestamp <= this value
- Returns:
- scanner
- Throws:
IOException
public Scanner getScanner(byte[][] columns, byte[] startRow, byte[] stopRow, long timestamp) throws IOException
stopRow.
Return the specified columns.
- Parameters:
columns
- columns to scan. If column name is a column family, all
columns of the specified column family are returned. Its also possible
to pass a regex in the column qualifier. A column qualifier is judged to
be a regex if it contains at least one of the following characters:
\+|^&*$[]]}{)(
.startRow
- starting row in table to scanstopRow
- Row to stop scanning on. Once we hit this row we stop
returning values; i.e. we return the row before this one but not the
stopRow
itself.timestamp
- only return results whose timestamp <= this value
- Returns:
- scanner
- Throws:
IOException
public Scanner getScanner(String[] columns, String startRow, long timestamp, RowFilterInterface filter) throws IOException
columns
- columns to scan. If column name is a column family, all
columns of the specified column family are returned. Its also possible
to pass a regex in the column qualifier. A column qualifier is judged to
be a regex if it contains at least one of the following characters:
\+|^&*$[]]}{)(
.startRow
- starting row in table to scantimestamp
- only return results whose timestamp <= this valuefilter
- a row filter using row-key regexp and/or column data filter.
IOException
public Scanner getScanner(byte[][] columns, byte[] startRow, long timestamp, RowFilterInterface filter) throws IOException
columns
- columns to scan. If column name is a column family, all
columns of the specified column family are returned. Its also possible
to pass a regex in the column qualifier. A column qualifier is judged to
be a regex if it contains at least one of the following characters:
\+|^&*$[]]}{)(
.startRow
- starting row in table to scantimestamp
- only return results whose timestamp <= this valuefilter
- a row filter using row-key regexp and/or column data filter.
IOException
public void deleteAll(byte[] row) throws IOException
row
- Key of the row you want to completely delete.
IOException
public void deleteAll(String row) throws IOException
row
- Key of the row you want to completely delete.
IOException
public void deleteAll(byte[] row, byte[] column) throws IOException
row
- Key of the row you want to completely delete.column
- column to be deleted
IOException
public void deleteAll(byte[] row, long ts) throws IOException
row
- Key of the row you want to completely delete.ts
- Delete all cells of the same timestamp or older.
IOException
public void deleteAll(String row, long ts) throws IOException
row
- Key of the row you want to completely delete.ts
- Delete all cells of the same timestamp or older.
IOException
public void deleteAll(String row, String column) throws IOException
row
- Row to updatecolumn
- name of column whose value is to be deleted
IOException
public void deleteAll(String row, String column, long ts) throws IOException
row
- Row to updatecolumn
- name of column whose value is to be deletedts
- Delete all cells of the same timestamp or older.
IOException
public void deleteAll(byte[] row, byte[] column, long ts) throws IOException
row
- Row to updatecolumn
- name of column whose value is to be deletedts
- Delete all cells of the same timestamp or older.
IOException
public void deleteAll(byte[] row, byte[] column, long ts, RowLock rl) throws IOException
row
- Row to updatecolumn
- name of column whose value is to be deletedts
- Delete all cells of the same timestamp or older.rl
- Existing row lock
IOException
public void deleteFamily(String row, String family) throws IOException
row
- The row to operate onfamily
- The column family to match
IOException
public void deleteFamily(byte[] row, byte[] family) throws IOException
row
- The row to operate onfamily
- The column family to match
IOException
public void deleteFamily(String row, String family, long timestamp) throws IOException
row
- The row to operate onfamily
- The column family to matchtimestamp
- Timestamp to match
IOException
public void deleteFamily(byte[] row, byte[] family, long timestamp) throws IOException
row
- The row to operate onfamily
- The column family to matchtimestamp
- Timestamp to match
IOException
public void deleteFamily(byte[] row, byte[] family, long timestamp, RowLock rl) throws IOException
row
- The row to operate onfamily
- The column family to matchtimestamp
- Timestamp to matchrl
- Existing row lock
IOException
public void commit(BatchUpdate batchUpdate) throws IOException
batchUpdate
-
IOException
public void commit(BatchUpdate batchUpdate, RowLock rl) throws IOException
batchUpdate
- rl
- Existing row lock
IOException
public void commit(List<BatchUpdate> batchUpdates) throws IOException
batchUpdates
-
IOException
public RowLock lockRow(byte[] row) throws IOException
row
- The row to lock
IOException
public void unlockRow(RowLock rl) throws IOException
rl
- The row lock to release
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |