Thrift module: Hbase

ModuleServicesData typesConstants
HbaseHbase
AlreadyExists
BatchMutation
Bytes
ColumnDescriptor
IOError
IllegalArgument
Mutation
ScannerID
TCell
TRegionInfo
TRowResult
Text

Type declarations

Typedef: Text

Base type: string

Typedef: Bytes

Base type: string

Typedef: ScannerID

Base type: i32


Data structures

Struct: TCell

FieldTypeDescriptionRequiredDefault value
valueBytesyes
timestampi64yes

TCell - Used to transport a cell value (byte[]) and the timestamp it was stored with together as a result for get and getRow methods. This promotes the timestamp of a cell to a first-class value, making it easy to take note of temporal data. Cell is used all the way from HStore up to HTable.

Struct: ColumnDescriptor

FieldTypeDescriptionRequiredDefault value
nameTextyes
maxVersionsi32yes3
compressionstringyes"NONE"
inMemoryboolyes0
bloomFilterTypestringyes"NONE"
bloomFilterVectorSizei32yes0
bloomFilterNbHashesi32yes0
blockCacheEnabledboolyes0
timeToLivei32yes-1

An HColumnDescriptor contains information about a column family such as the number of versions, compression settings, etc. It is used as input when creating a table or adding a column.

Struct: TRegionInfo

FieldTypeDescriptionRequiredDefault value
startKeyTextyes
endKeyTextyes
idi64yes
nameTextyes
versionbyteyes

A TRegionInfo contains information about an HTable region.

Struct: Mutation

FieldTypeDescriptionRequiredDefault value
isDeleteboolyes0
columnTextyes
valueTextyes

A Mutation object is used to either update or delete a column-value.

Struct: BatchMutation

FieldTypeDescriptionRequiredDefault value
rowTextyes
mutationslist<Mutation>yes

A BatchMutation object is used to apply a number of Mutations to a single row.

Struct: TRowResult

FieldTypeDescriptionRequiredDefault value
rowTextyes
columnsmap<Text, TCell>yes

Holds row name and then a map of columns to cells.

Exception: IOError

FieldTypeDescriptionRequiredDefault value
messagestringyes

An IOError exception signals that an error occurred communicating to the Hbase master or an Hbase region server. Also used to return more general Hbase error conditions.

Exception: IllegalArgument

FieldTypeDescriptionRequiredDefault value
messagestringyes

An IllegalArgument exception indicates an illegal or invalid argument was passed into a procedure.

Exception: AlreadyExists

FieldTypeDescriptionRequiredDefault value
messagestringyes

An AlreadyExists exceptions signals that a table with the specified name already exists

Services

Service: Hbase

Function: Hbase.enableTable

void enableTable(Bytes tableName)
    throws IOError
Brings a table on-line (enables it)

Parameters
NameDescription
tableNamename of the table

Function: Hbase.disableTable

void disableTable(Bytes tableName)
    throws IOError
Disables a table (takes it off-line) If it is being served, the master will tell the servers to stop serving it.

Parameters
NameDescription
tableNamename of the table

Function: Hbase.isTableEnabled

bool isTableEnabled(Bytes tableName)
    throws IOError
@return true if table is on-line

Parameters
NameDescription
tableNamename of the table to check

Function: Hbase.compact

void compact(Bytes tableNameOrRegionName)
    throws IOError

Parameters
NameDescription
tableNameOrRegionName

Function: Hbase.majorCompact

void majorCompact(Bytes tableNameOrRegionName)
    throws IOError

Parameters
NameDescription
tableNameOrRegionName

Function: Hbase.getTableNames

list<Text> getTableNames()
    throws IOError
List all the userspace tables.

@return returns a list of names

Function: Hbase.getColumnDescriptors

map<Text, ColumnDescriptor> getColumnDescriptors(Text tableName)
    throws IOError
List all the column families assoicated with a table.

@return list of column family descriptors

Parameters
NameDescription
tableNametable name

Function: Hbase.getTableRegions

list<TRegionInfo> getTableRegions(Text tableName)
    throws IOError
List the regions associated with a table.

@return list of region descriptors

Parameters
NameDescription
tableNametable name

Function: Hbase.createTable

void createTable(Text tableName,
                 list<ColumnDescriptor> columnFamilies)
    throws IOError, IllegalArgument, AlreadyExists
Create a table with the specified column families. The name field for each ColumnDescriptor must be set and must end in a colon (:). All other fields are optional and will get default values if not explicitly specified.

@throws IllegalArgument if an input parameter is invalid

@throws AlreadyExists if the table name already exists

Parameters
NameDescription
tableNamename of table to create
columnFamilieslist of column family descriptors

Function: Hbase.deleteTable

void deleteTable(Text tableName)
    throws IOError
Deletes a table

@throws IOError if table doesn't exist on server or there was some other problem

Parameters
NameDescription
tableNamename of table to delete

Function: Hbase.get

list<TCell> get(Text tableName,
                Text row,
                Text column)
    throws IOError
Get a single TCell for the specified table, row, and column at the latest timestamp. Returns an empty list if no such value exists.

@return value for specified row/column

Parameters
NameDescription
tableNamename of table
rowrow key
columncolumn name

Function: Hbase.getVer

list<TCell> getVer(Text tableName,
                   Text row,
                   Text column,
                   i32 numVersions)
    throws IOError
Get the specified number of versions for the specified table, row, and column.

@return list of cells for specified row/column

Parameters
NameDescription
tableNamename of table
rowrow key
columncolumn name
numVersionsnumber of versions to retrieve

Function: Hbase.getVerTs

list<TCell> getVerTs(Text tableName,
                     Text row,
                     Text column,
                     i64 timestamp,
                     i32 numVersions)
    throws IOError
Get the specified number of versions for the specified table, row, and column. Only versions less than or equal to the specified timestamp will be returned.

@return list of cells for specified row/column

Parameters
NameDescription
tableNamename of table
rowrow key
columncolumn name
timestamptimestamp
numVersionsnumber of versions to retrieve

Function: Hbase.getRow

list<TRowResult> getRow(Text tableName,
                        Text row)
    throws IOError
Get all the data for the specified table and row at the latest timestamp. Returns an empty list if the row does not exist.

@return TRowResult containing the row and map of columns to TCells

Parameters
NameDescription
tableNamename of table
rowrow key

Function: Hbase.getRowWithColumns

list<TRowResult> getRowWithColumns(Text tableName,
                                   Text row,
                                   list<Text> columns)
    throws IOError
Get the specified columns for the specified table and row at the latest timestamp. Returns an empty list if the row does not exist.

@return TRowResult containing the row and map of columns to TCells

Parameters
NameDescription
tableNamename of table
rowrow key
columnsList of columns to return, null for all columns

Function: Hbase.getRowTs

list<TRowResult> getRowTs(Text tableName,
                          Text row,
                          i64 timestamp)
    throws IOError
Get all the data for the specified table and row at the specified timestamp. Returns an empty list if the row does not exist.

@return TRowResult containing the row and map of columns to TCells

Parameters
NameDescription
tableNamename of the table
rowrow key
timestamptimestamp

Function: Hbase.getRowWithColumnsTs

list<TRowResult> getRowWithColumnsTs(Text tableName,
                                     Text row,
                                     list<Text> columns,
                                     i64 timestamp)
    throws IOError
Get the specified columns for the specified table and row at the specified timestamp. Returns an empty list if the row does not exist.

@return TRowResult containing the row and map of columns to TCells

Parameters
NameDescription
tableNamename of table
rowrow key
columnsList of columns to return, null for all columns
timestamp

Function: Hbase.mutateRow

void mutateRow(Text tableName,
               Text row,
               list<Mutation> mutations)
    throws IOError, IllegalArgument
Apply a series of mutations (updates/deletes) to a row in a single transaction. If an exception is thrown, then the transaction is aborted. Default current timestamp is used, and all entries will have an identical timestamp.

Parameters
NameDescription
tableNamename of table
rowrow key
mutationslist of mutation commands

Function: Hbase.mutateRowTs

void mutateRowTs(Text tableName,
                 Text row,
                 list<Mutation> mutations,
                 i64 timestamp)
    throws IOError, IllegalArgument
Apply a series of mutations (updates/deletes) to a row in a single transaction. If an exception is thrown, then the transaction is aborted. The specified timestamp is used, and all entries will have an identical timestamp.

Parameters
NameDescription
tableNamename of table
rowrow key
mutationslist of mutation commands
timestamptimestamp

Function: Hbase.mutateRows

void mutateRows(Text tableName,
                list<BatchMutation> rowBatches)
    throws IOError, IllegalArgument
Apply a series of batches (each a series of mutations on a single row) in a single transaction. If an exception is thrown, then the transaction is aborted. Default current timestamp is used, and all entries will have an identical timestamp.

Parameters
NameDescription
tableNamename of table
rowBatcheslist of row batches

Function: Hbase.mutateRowsTs

void mutateRowsTs(Text tableName,
                  list<BatchMutation> rowBatches,
                  i64 timestamp)
    throws IOError, IllegalArgument
Apply a series of batches (each a series of mutations on a single row) in a single transaction. If an exception is thrown, then the transaction is aborted. The specified timestamp is used, and all entries will have an identical timestamp.

Parameters
NameDescription
tableNamename of table
rowBatcheslist of row batches
timestamptimestamp

Function: Hbase.atomicIncrement

i64 atomicIncrement(Text tableName,
                    Text row,
                    Text column,
                    i64 value)
    throws IOError, IllegalArgument
Atomically increment the column value specified. Returns the next value post increment.

Parameters
NameDescription
tableNamename of table
rowrow to increment
columnname of column
valueamount to increment by

Function: Hbase.deleteAll

void deleteAll(Text tableName,
               Text row,
               Text column)
    throws IOError
Delete all cells that match the passed row and column.

Parameters
NameDescription
tableNamename of table
rowRow to update
columnname of column whose value is to be deleted

Function: Hbase.deleteAllTs

void deleteAllTs(Text tableName,
                 Text row,
                 Text column,
                 i64 timestamp)
    throws IOError
Delete all cells that match the passed row and column and whose timestamp is equal-to or older than the passed timestamp.

Parameters
NameDescription
tableNamename of table
rowRow to update
columnname of column whose value is to be deleted
timestamptimestamp

Function: Hbase.deleteAllRow

void deleteAllRow(Text tableName,
                  Text row)
    throws IOError
Completely delete the row's cells.

Parameters
NameDescription
tableNamename of table
rowkey of the row to be completely deleted.

Function: Hbase.deleteAllRowTs

void deleteAllRowTs(Text tableName,
                    Text row,
                    i64 timestamp)
    throws IOError
Completely delete the row's cells marked with a timestamp equal-to or older than the passed timestamp.

Parameters
NameDescription
tableNamename of table
rowkey of the row to be completely deleted.
timestamptimestamp

Function: Hbase.scannerOpen

ScannerID scannerOpen(Text tableName,
                      Text startRow,
                      list<Text> columns)
    throws IOError
Get a scanner on the current table starting at the specified row and ending at the last row in the table. Return the specified columns.

@return scanner id to be used with other scanner procedures

Parameters
NameDescription
tableNamename of table
startRowStarting row in table to scan. Send "" (empty string) to start at the first row.
columnscolumns to scan. If column name is a column family, all columns of the specified column family are returned. It's also possible to pass a regex in the column qualifier.

Function: Hbase.scannerOpenWithStop

ScannerID scannerOpenWithStop(Text tableName,
                              Text startRow,
                              Text stopRow,
                              list<Text> columns)
    throws IOError
Get a scanner on the current table starting and stopping at the specified rows. ending at the last row in the table. Return the specified columns.

@return scanner id to be used with other scanner procedures

Parameters
NameDescription
tableNamename of table
startRowStarting row in table to scan. Send "" (empty string) to start at the first row.
stopRowrow to stop scanning on. This row is *not* included in the scanner's results
columnscolumns to scan. If column name is a column family, all columns of the specified column family are returned. It's also possible to pass a regex in the column qualifier.

Function: Hbase.scannerOpenWithPrefix

ScannerID scannerOpenWithPrefix(Text tableName,
                                Text startAndPrefix,
                                list<Text> columns)
    throws IOError
Open a scanner for a given prefix. That is all rows will have the specified prefix. No other rows will be returned.

@return scanner id to use with other scanner calls

Parameters
NameDescription
tableNamename of table
startAndPrefixthe prefix (and thus start row) of the keys you want
columnsthe columns you want returned

Function: Hbase.scannerOpenTs

ScannerID scannerOpenTs(Text tableName,
                        Text startRow,
                        list<Text> columns,
                        i64 timestamp)
    throws IOError
Get a scanner on the current table starting at the specified row and ending at the last row in the table. Return the specified columns. Only values with the specified timestamp are returned.

@return scanner id to be used with other scanner procedures

Parameters
NameDescription
tableNamename of table
startRowStarting row in table to scan. Send "" (empty string) to start at the first row.
columnscolumns to scan. If column name is a column family, all columns of the specified column family are returned. It's also possible to pass a regex in the column qualifier.
timestamptimestamp

Function: Hbase.scannerOpenWithStopTs

ScannerID scannerOpenWithStopTs(Text tableName,
                                Text startRow,
                                Text stopRow,
                                list<Text> columns,
                                i64 timestamp)
    throws IOError
Get a scanner on the current table starting and stopping at the specified rows. ending at the last row in the table. Return the specified columns. Only values with the specified timestamp are returned.

@return scanner id to be used with other scanner procedures

Parameters
NameDescription
tableNamename of table
startRowStarting row in table to scan. Send "" (empty string) to start at the first row.
stopRowrow to stop scanning on. This row is *not* included in the scanner's results
columnscolumns to scan. If column name is a column family, all columns of the specified column family are returned. It's also possible to pass a regex in the column qualifier.
timestamptimestamp

Function: Hbase.scannerGet

list<TRowResult> scannerGet(ScannerID id)
    throws IOError, IllegalArgument
Returns the scanner's current row value and advances to the next row in the table. When there are no more rows in the table, or a key greater-than-or-equal-to the scanner's specified stopRow is reached, an empty list is returned.

@return a TRowResult containing the current row and a map of the columns to TCells.

@throws IllegalArgument if ScannerID is invalid

@throws NotFound when the scanner reaches the end

Parameters
NameDescription
idid of a scanner returned by scannerOpen

Function: Hbase.scannerGetList

list<TRowResult> scannerGetList(ScannerID id,
                                i32 nbRows)
    throws IOError, IllegalArgument
Returns, starting at the scanner's current row value nbRows worth of rows and advances to the next row in the table. When there are no more rows in the table, or a key greater-than-or-equal-to the scanner's specified stopRow is reached, an empty list is returned.

@return a TRowResult containing the current row and a map of the columns to TCells.

@throws IllegalArgument if ScannerID is invalid

@throws NotFound when the scanner reaches the end

Parameters
NameDescription
idid of a scanner returned by scannerOpen
nbRowsnumber of results to return

Function: Hbase.scannerClose

void scannerClose(ScannerID id)
    throws IOError, IllegalArgument
Closes the server-state associated with an open scanner.

@throws IllegalArgument if ScannerID is invalid

Parameters
NameDescription
idid of a scanner returned by scannerOpen