Database Reference
In-Depth Information
The scan() operation also deines one more optional parameter called ilter. This
ilter is the instance of the Filter class present in the org.apache.hadoop.hbase.
filter package.
Filters limit data retrieval by adding limiting selectors to the get()
or scan() operation. Filters will be discussed in detail in the
following section.
Once we have the results from the scan constructor, the following methods can be
used to further narrow down the results:
Method name
Description
addFamily(byte[] family)
Gets all columns from the specified family.
addColumn(byte[] family,
byte[] qualifier)
Gets the column from the specific family
with the specified qualifier.
setTimeRange(long minStamp,
long maxStamp)
Gets versions of columns only within the
specified timestamp range ( minStamp ,
maxStamp ).
setTimeStamp(long timestamp)
Gets versions of columns with the specified
timestamp.
setMaxVersions(int
maxVersions)
Gets 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.
setFilter(Filter filter)
Applies the specified server-side filter
when performing the query.
setStartRow(byte[] startRow)
Sets the start row of the scan.
setStopRow(byte[] stopRow)
Sets the stop row.
As discussed, we have multiple constructors for the Scan class, but we do not have
any method call for scanning the results within the HTable class. We need to call the
getScanner() method available in the HTable class to get the instance of the scan
and browse through the results.
Method
Description
getScanner(byte[] family)
Gets a scanner on the current table for the
given family
getScanner(byte[] family,
byte[] qualifier)
Gets a scanner on the current table for the
given family and qualifier
getScanner(Scan scan)
Returns a scanner on the current table as
specified by the Scan object
Search WWH ::




Custom Search