Database Reference
In-Depth Information
A few other important methods of the Put class can be found in the following table:
Method name
Description
get(byte[] family, byte[]
qualifier)
This returns a list of all the key-value objects with
a matching column family and a qualifier
has(byte[] family, byte[]
qualifier, byte[] value)
This is a convenience method that determines
whether the object's family map contains a value
assigned to the given family, qualifier, and
timestamp
Reading data
HBase uses an LRU cache for reads, which is also called the block cache. This block
cache keeps the frequently accessed data from the HFiles in the memory to avoid
frequent disk reads, and every column family has its own block cache. Whenever a
read request arrives, the block cache is irst checked for the relevant row. If it is not
found, the HFiles on the disk are then checked for the same. Similar to the Put class,
the Get class instance is used to read the data back from the HBase table. The HBase
table deines the following method for reading the data and takes the Get class
instance as an argument:
Result get(Get getInst)
This method extracts certain cells from a given row. Here, the Get class instance can
be created by either of the class constructors:
Get(byte[] rowkey)
This constructor creates a Get operation for the speciied row identiied by the
rowkey. For narrowing down the data search to a speciic cell, additional methods
are provided in the following table:
Method name
Description
addFamily(byte[] family)
Get all columns from the specified family
addColumn(byte[] family,
byte[] qualifier)
Get the column from the specific family with the
specified qualifier
setTimeRange(long minStamp,
long maxStamp)
Get versions of columns only within the specified
timestamp range (minStamp, maxStamp)
setTimeStamp(long timestamp) Get versions of columns with the specified
timestamp
setMaxVersions ( int max
versions)
Get up to the specified number of versions of
each column. The default value of the maximum
version returned is 1 which is the latest cell value.
 
Search WWH ::




Custom Search