Class Get
- All Implemented Interfaces:
Comparable<Row>,Attributes,Row
To get everything for a row, instantiate a Get object with the row to get. To further narrow the scope of what to Get, use the methods below.
To get all columns from specific families, execute addFamily for each
family to retrieve.
To get specific columns, execute addColumn for each column to
retrieve.
To only retrieve columns within a specific range of version timestamps, execute
setTimeRange.
To only retrieve columns with a specific timestamp, execute setTimestamp.
To limit the number of versions of each column to be returned, execute
setMaxVersions.
To add a filter, call setFilter.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate booleanprivate booleanprivate Map<byte[],NavigableSet<byte[]>> private static final org.slf4j.Loggerprivate intprivate byte[]private intprivate intprivate TimeRangeFields inherited from class org.apache.hadoop.hbase.client.Query
colFamTimeRangeMap, consistency, filter, loadColumnFamiliesOnDemand, targetReplicaIdFields inherited from class org.apache.hadoop.hbase.client.OperationWithAttributes
ID_ATRIBUTEFields inherited from interface org.apache.hadoop.hbase.client.Row
COMPARATOR -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddColumn(byte[] family, byte[] qualifier) Get the column from the specific family with the specified qualifier.addFamily(byte[] family) Get all columns from the specified family.intCompare this row to another row.booleanSet<byte[]>Method for retrieving the keys in the familyMapbooleanGet whether blocks should be cached for this Get.Map<byte[],NavigableSet<byte[]>> Method for retrieving the get's familyMapCompile the table and column family (i.e.intMethod for retrieving the get's maximum number of values to return per Column FamilyintMethod for retrieving the get's maximum number of versionbyte[]getRow()Method for retrieving the get's rowintMethod for retrieving the get's offset per row per column family (#kvs to be skipped)Method for retrieving the get's TimeRangebooleanMethod for checking if any families have been inserted into this GetinthashCode()booleanbooleanDeprecated.since 2.0.0 and will be removed in 3.0.0intMethod for retrieving the number of families to get fromGet all available versions.readVersions(int versions) Get up to the specified number of versions of each column.setACL(String user, Permission perms) Set the ACL for the operation.setACL(Map<String, Permission> perms) Set the ACL for the operation.setAttribute(String name, byte[] value) Sets an attribute.setAuthorizations(Authorizations authorizations) Sets the authorizations to be used by this QuerysetCacheBlocks(boolean cacheBlocks) Set whether blocks should be cached for this Get.setCheckExistenceOnly(boolean checkExistenceOnly) setClosestRowBefore(boolean closestRowBefore) Deprecated.since 2.0.0 and will be removed in 3.0.0setColumnFamilyTimeRange(byte[] cf, long minStamp, long maxStamp) Get versions of columns only within the specified timestamp range, [minStamp, maxStamp) on a per CF bases.setConsistency(Consistency consistency) Sets the consistency level for this operationApply the specified server-side filter when performing the Query.This method allows you to set an identifier on an operation.setIsolationLevel(IsolationLevel level) Set the isolation level for this query.setLoadColumnFamiliesOnDemand(boolean value) Set the value indicating whether loading CFs on demand should be allowed (cluster default is false).setMaxResultsPerColumnFamily(int limit) Set the maximum number of values to return per row per Column FamilyDeprecated.It is easy to misunderstand with column family's max versions, so usereadAllVersions()instead.setMaxVersions(int maxVersions) Deprecated.It is easy to misunderstand with column family's max versions, so usereadVersions(int)instead.setPriority(int priority) setReplicaId(int Id) Specify region replica id where Query will fetch data from.setRowOffsetPerColumnFamily(int offset) Set offset for the row per Column Family.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.setTimeStamp(long timestamp) Deprecated.As of release 2.0.0, this will be removed in HBase 3.0.0.toMap(int maxCols) Compile the details beyond the scope of getFingerprint (row, columns, timestamps, etc.) into a Map along with the fingerprinted information.Methods inherited from class org.apache.hadoop.hbase.client.Query
doLoadColumnFamiliesOnDemand, getACL, getAuthorizations, getColumnFamilyTimeRange, getConsistency, getFilter, getIsolationLevel, getLoadColumnFamiliesOnDemandValue, getReplicaIdMethods inherited from class org.apache.hadoop.hbase.client.OperationWithAttributes
getAttribute, getAttributeSize, getAttributesMap, getId, getPriority
-
Field Details
-
LOG
-
row
-
maxVersions
-
cacheBlocks
-
storeLimit
-
storeOffset
-
tr
-
checkExistenceOnly
-
closestRowBefore
-
familyMap
-
-
Constructor Details
-
Get
Create a Get operation for the specified row.If no further operations are done, this will get the latest version of all columns in all families of the specified row.
- Parameters:
row- row key
-
Get
Copy-constructor -
Get
Create a Get operation for the specified row. -
Get
Create a Get operation for the specified row.
-
-
Method Details
-
isCheckExistenceOnly
-
setCheckExistenceOnly
-
isClosestRowBefore
Deprecated.since 2.0.0 and will be removed in 3.0.0This will always return the default value which is false as client cannot set the value to this property any more. -
setClosestRowBefore
Deprecated.since 2.0.0 and will be removed in 3.0.0This is not used any more and does nothing. Use reverse scan instead. -
addFamily
Get all columns from the specified family.Overrides previous calls to addColumn for this family.
- Parameters:
family- family name- Returns:
- the Get object
-
addColumn
Get the column from the specific family with the specified qualifier.Overrides previous calls to addFamily for this family.
- Parameters:
family- family namequalifier- column qualifier- Returns:
- the Get objec
-
setTimeRange
Get versions of columns only within the specified timestamp range, [minStamp, maxStamp).- Parameters:
minStamp- minimum timestamp value, inclusivemaxStamp- maximum timestamp value, exclusive- Returns:
- this for invocation chaining
- Throws:
IOException
-
setTimeStamp
Deprecated.As of release 2.0.0, this will be removed in HBase 3.0.0. UsesetTimestamp(long)insteadGet versions of columns with the specified timestamp.- Parameters:
timestamp- version timestamp- Returns:
- this for invocation chaining
- Throws:
IOException
-
setTimestamp
Get versions of columns with the specified timestamp.- Parameters:
timestamp- version timestamp- Returns:
- this for invocation chaining
-
setColumnFamilyTimeRange
Description copied from class:QueryGet versions of columns only within the specified timestamp range, [minStamp, maxStamp) on a per CF bases. Note, default maximum versions to return is 1. If your time range spans more than one version and you want all versions returned, up the number of versions beyond the default. Column Family time ranges take precedence over the global time range.- Overrides:
setColumnFamilyTimeRangein classQuery- Parameters:
cf- the column family for which you want to restrictminStamp- minimum timestamp value, inclusivemaxStamp- maximum timestamp value, exclusive
-
setMaxVersions
Deprecated.It is easy to misunderstand with column family's max versions, so usereadAllVersions()instead.Get all available versions.- Returns:
- this for invocation chaining
-
setMaxVersions
Deprecated.It is easy to misunderstand with column family's max versions, so usereadVersions(int)instead.Get up to the specified number of versions of each column.- Parameters:
maxVersions- maximum versions for each column- Returns:
- this for invocation chaining
- Throws:
IOException- if invalid number of versions
-
readAllVersions
Get all available versions.- Returns:
- this for invocation chaining
-
readVersions
Get up to the specified number of versions of each column.- Parameters:
versions- specified number of versions for each column- Returns:
- this for invocation chaining
- Throws:
IOException- if invalid number of versions
-
setLoadColumnFamiliesOnDemand
Description copied from class:QuerySet the value indicating whether loading CFs on demand should be allowed (cluster default is false). On-demand CF loading doesn't load column families until necessary, e.g. if you filter on one column, the other column family data will be loaded only for the rows that are included in result, not all rows like in normal case. With column-specific filters, like SingleColumnValueFilter w/filterIfMissing == true, this can deliver huge perf gains when there's a cf with lots of data; however, it can also lead to some inconsistent results, as follows: - if someone does a concurrent update to both column families in question you may get a row that never existed, e.g. for { rowKey = 5, { cat_videos => 1 }, { video => "my cat" } } someone puts rowKey 5 with { cat_videos => 0 }, { video => "my dog" }, concurrent scan filtering on "cat_videos == 1" can get { rowKey = 5, { cat_videos => 1 }, { video => "my dog" } }. - if there's a concurrent split and you have more than 2 column families, some rows may be missing some column families.- Overrides:
setLoadColumnFamiliesOnDemandin classQuery
-
setMaxResultsPerColumnFamily
Set the maximum number of values to return per row per Column Family- Parameters:
limit- the maximum number of values returned / row / CF- Returns:
- this for invocation chaining
-
setRowOffsetPerColumnFamily
Set offset for the row per Column Family. This offset is only within a particular row/CF combination. It gets reset back to zero when we move to the next row or CF.- Parameters:
offset- is the number of kvs that will be skipped.- Returns:
- this for invocation chaining
-
setFilter
Description copied from class:QueryApply the specified server-side filter when performing the Query. OnlyFilter.filterCell(org.apache.hadoop.hbase.Cell)is called AFTER all tests for ttl, column match, deletes and column family's max versions have been run. -
setCacheBlocks
Set whether blocks should be cached for this Get.This is true by default. When true, default settings of the table and family are used (this will never override caching blocks if the block cache is disabled for that family or entirely).
- Parameters:
cacheBlocks- if false, default settings are overridden and blocks will not be cached
-
getCacheBlocks
Get whether blocks should be cached for this Get.- Returns:
- true if default caching should be used, false if blocks should not be cached
-
getRow
Method for retrieving the get's row -
getMaxVersions
Method for retrieving the get's maximum number of version- Returns:
- the maximum number of version to fetch for this get
-
getMaxResultsPerColumnFamily
Method for retrieving the get's maximum number of values to return per Column Family- Returns:
- the maximum number of values to fetch per CF
-
getRowOffsetPerColumnFamily
Method for retrieving the get's offset per row per column family (#kvs to be skipped)- Returns:
- the row offset
-
getTimeRange
Method for retrieving the get's TimeRange -
familySet
Method for retrieving the keys in the familyMap- Returns:
- keys in the current familyMap
-
numFamilies
Method for retrieving the number of families to get from- Returns:
- number of families
-
hasFamilies
Method for checking if any families have been inserted into this Get- Returns:
- true if familyMap is non empty false otherwise
-
getFamilyMap
Method for retrieving the get's familyMap -
getFingerprint
Compile the table and column family (i.e. schema) information into a String. Useful for parsing and aggregation by debugging, logging, and administration tools.- Specified by:
getFingerprintin classOperation- Returns:
- a map containing fingerprint information (i.e. column families)
-
toMap
Compile the details beyond the scope of getFingerprint (row, columns, timestamps, etc.) into a Map along with the fingerprinted information. Useful for debugging, logging, and administration tools. -
compareTo
Description copied from interface:RowCompare this row to another row.- Specified by:
compareToin interfaceComparable<Row>- Specified by:
compareToin interfaceRow
-
hashCode
-
equals
-
setAttribute
Description copied from interface:AttributesSets an attribute. In case value = null attribute is removed from the attributes map. Attribute names starting with _ indicate system attributes.- Specified by:
setAttributein interfaceAttributes- Overrides:
setAttributein classOperationWithAttributes- Parameters:
name- attribute namevalue- attribute value
-
setId
Description copied from class:OperationWithAttributesThis method allows you to set an identifier on an operation. The original motivation for this was to allow the identifier to be used in slow query logging, but this could obviously be useful in other places. One use of this could be to put a class.method identifier in here to see where the slow query is coming from. id to set for the scan- Overrides:
setIdin classOperationWithAttributes
-
setAuthorizations
Description copied from class:QuerySets the authorizations to be used by this Query- Overrides:
setAuthorizationsin classQuery
-
setACL
Description copied from class:QuerySet the ACL for the operation. -
setACL
Description copied from class:QuerySet the ACL for the operation. -
setConsistency
Description copied from class:QuerySets the consistency level for this operation- Overrides:
setConsistencyin classQuery- Parameters:
consistency- the consistency level
-
setReplicaId
Description copied from class:QuerySpecify region replica id where Query will fetch data from. Use this together withQuery.setConsistency(Consistency)passingConsistency.TIMELINEto read data from a specific replicaId.
Expert: This is an advanced API exposed. Only use it if you know what you are doing- Overrides:
setReplicaIdin classQuery
-
setIsolationLevel
Description copied from class:QuerySet the isolation level for this query. If the isolation level is set to READ_UNCOMMITTED, then this query will return data from committed and uncommitted transactions. If the isolation level is set to READ_COMMITTED, then this query will return data from committed transactions only. If a isolation level is not explicitly set on a Query, then it is assumed to be READ_COMMITTED.- Overrides:
setIsolationLevelin classQuery- Parameters:
level- IsolationLevel for this query
-
setPriority
- Overrides:
setPriorityin classOperationWithAttributes
-