@InterfaceAudience.Public public class Get extends Query implements 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
.
Modifier and Type | Field and Description |
---|---|
private boolean |
cacheBlocks |
private boolean |
checkExistenceOnly |
private boolean |
closestRowBefore |
private Map<byte[],NavigableSet<byte[]>> |
familyMap |
private static org.slf4j.Logger |
LOG |
private int |
maxVersions |
private byte[] |
row |
private int |
storeLimit |
private int |
storeOffset |
private TimeRange |
tr |
colFamTimeRangeMap, consistency, filter, loadColumnFamiliesOnDemand, targetReplicaId
ID_ATRIBUTE
COMPARATOR
Constructor and Description |
---|
Get(byte[] row)
Create a Get operation for the specified row.
|
Get(byte[] row,
int rowOffset,
int rowLength)
Create a Get operation for the specified row.
|
Get(ByteBuffer row)
Create a Get operation for the specified row.
|
Get(Get get)
Copy-constructor n
|
Modifier and Type | Method and Description |
---|---|
Get |
addColumn(byte[] family,
byte[] qualifier)
Get the column from the specific family with the specified qualifier.
|
Get |
addFamily(byte[] family)
Get all columns from the specified family.
|
int |
compareTo(Row other)
Compare this row to another row.
|
boolean |
equals(Object obj) |
Set<byte[]> |
familySet()
Method for retrieving the keys in the familyMap
|
boolean |
getCacheBlocks()
Get whether blocks should be cached for this Get.
|
Map<byte[],NavigableSet<byte[]>> |
getFamilyMap()
Method for retrieving the get's familyMap n
|
Map<String,Object> |
getFingerprint()
Compile the table and column family (i.e.
|
int |
getMaxResultsPerColumnFamily()
Method for retrieving the get's maximum number of values to return per Column Family
|
int |
getMaxVersions()
Method for retrieving the get's maximum number of version
|
byte[] |
getRow()
Method for retrieving the get's row n
|
int |
getRowOffsetPerColumnFamily()
Method for retrieving the get's offset per row per column family (#kvs to be skipped)
|
TimeRange |
getTimeRange()
Method for retrieving the get's TimeRange n
|
boolean |
hasFamilies()
Method for checking if any families have been inserted into this Get
|
int |
hashCode() |
boolean |
isCheckExistenceOnly() |
boolean |
isClosestRowBefore()
Deprecated.
since 2.0.0 and will be removed in 3.0.0
|
int |
numFamilies()
Method for retrieving the number of families to get from
|
Get |
readAllVersions()
Get all available versions.
|
Get |
readVersions(int versions)
Get up to the specified number of versions of each column.
|
Get |
setACL(Map<String,Permission> perms)
Set the ACL for the operation.
|
Get |
setACL(String user,
Permission perms)
Set the ACL for the operation.
|
Get |
setAttribute(String name,
byte[] value)
Sets an attribute.
|
Get |
setAuthorizations(Authorizations authorizations)
Sets the authorizations to be used by this Query n
|
Get |
setCacheBlocks(boolean cacheBlocks)
Set whether blocks should be cached for this Get.
|
Get |
setCheckExistenceOnly(boolean checkExistenceOnly) |
Get |
setClosestRowBefore(boolean closestRowBefore)
Deprecated.
since 2.0.0 and will be removed in 3.0.0
|
Get |
setColumnFamilyTimeRange(byte[] cf,
long minStamp,
long maxStamp)
Get versions of columns only within the specified timestamp range, [minStamp, maxStamp) on a
per CF bases.
|
Get |
setConsistency(Consistency consistency)
Sets the consistency level for this operation
|
Get |
setFilter(Filter filter)
Apply the specified server-side filter when performing the Query.
|
Get |
setId(String id)
This method allows you to set an identifier on an operation.
|
Get |
setIsolationLevel(IsolationLevel level)
Set the isolation level for this query.
|
Get |
setLoadColumnFamiliesOnDemand(boolean value)
Set the value indicating whether loading CFs on demand should be allowed (cluster default is
false).
|
Get |
setMaxResultsPerColumnFamily(int limit)
Set the maximum number of values to return per row per Column Family
|
Get |
setMaxVersions()
Deprecated.
It is easy to misunderstand with column family's max versions, so use
readAllVersions() instead. |
Get |
setMaxVersions(int maxVersions)
Deprecated.
It is easy to misunderstand with column family's max versions, so use
readVersions(int) instead. |
Get |
setPriority(int priority) |
Get |
setReplicaId(int Id)
Specify region replica id where Query will fetch data from.
|
Get |
setRowOffsetPerColumnFamily(int offset)
Set offset for the row per Column Family.
|
Get |
setTimeRange(long minStamp,
long maxStamp)
Get versions of columns only within the specified timestamp range, [minStamp, maxStamp).
|
Get |
setTimestamp(long timestamp)
Get versions of columns with the specified timestamp.
|
Get |
setTimeStamp(long timestamp)
Deprecated.
As of release 2.0.0, this will be removed in HBase 3.0.0. Use
setTimestamp(long) instead |
Map<String,Object> |
toMap(int maxCols)
Compile the details beyond the scope of getFingerprint (row, columns, timestamps, etc.) into a
Map along with the fingerprinted information.
|
doLoadColumnFamiliesOnDemand, getACL, getAuthorizations, getColumnFamilyTimeRange, getConsistency, getFilter, getIsolationLevel, getLoadColumnFamiliesOnDemandValue, getReplicaId
getAttribute, getAttributeSize, getAttributesMap, getId, getPriority
private static final org.slf4j.Logger LOG
private byte[] row
private int maxVersions
private boolean cacheBlocks
private int storeLimit
private int storeOffset
private boolean checkExistenceOnly
private boolean closestRowBefore
private Map<byte[],NavigableSet<byte[]>> familyMap
public Get(byte[] row)
If no further operations are done, this will get the latest version of all columns in all families of the specified row.
row
- row keypublic Get(byte[] row, int rowOffset, int rowLength)
public Get(ByteBuffer row)
public boolean isCheckExistenceOnly()
public Get setCheckExistenceOnly(boolean checkExistenceOnly)
@Deprecated public boolean isClosestRowBefore()
@Deprecated public Get setClosestRowBefore(boolean closestRowBefore)
public Get addFamily(byte[] family)
Overrides previous calls to addColumn for this family.
family
- family namepublic Get addColumn(byte[] family, byte[] qualifier)
Overrides previous calls to addFamily for this family.
family
- family namequalifier
- column qualifierpublic Get setTimeRange(long minStamp, long maxStamp) throws IOException
minStamp
- minimum timestamp value, inclusivemaxStamp
- maximum timestamp value, exclusive n * @return this for invocation chainingIOException
@Deprecated public Get setTimeStamp(long timestamp) throws IOException
setTimestamp(long)
insteadtimestamp
- version timestampIOException
public Get setTimestamp(long timestamp)
timestamp
- version timestamppublic Get setColumnFamilyTimeRange(byte[] cf, long minStamp, long maxStamp)
Query
setColumnFamilyTimeRange
in class Query
cf
- the column family for which you want to restrictminStamp
- minimum timestamp value, inclusivemaxStamp
- maximum timestamp value, exclusive n@Deprecated public Get setMaxVersions()
readAllVersions()
instead.@Deprecated public Get setMaxVersions(int maxVersions) throws IOException
readVersions(int)
instead.maxVersions
- maximum versions for each columnIOException
- if invalid number of versionspublic Get readAllVersions()
public Get readVersions(int versions) throws IOException
versions
- specified number of versions for each columnIOException
- if invalid number of versionspublic Get setLoadColumnFamiliesOnDemand(boolean value)
Query
setLoadColumnFamiliesOnDemand
in class Query
public Get setMaxResultsPerColumnFamily(int limit)
limit
- the maximum number of values returned / row / CFpublic Get setRowOffsetPerColumnFamily(int offset)
offset
- is the number of kvs that will be skipped.public Get setFilter(Filter filter)
Query
Filter.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.public Get setCacheBlocks(boolean cacheBlocks)
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).
cacheBlocks
- if false, default settings are overridden and blocks will not be cachedpublic boolean getCacheBlocks()
public byte[] getRow()
public int getMaxVersions()
public int getMaxResultsPerColumnFamily()
public int getRowOffsetPerColumnFamily()
public TimeRange getTimeRange()
public Set<byte[]> familySet()
public int numFamilies()
public boolean hasFamilies()
public Map<byte[],NavigableSet<byte[]>> getFamilyMap()
public Map<String,Object> getFingerprint()
getFingerprint
in class Operation
public Map<String,Object> toMap(int maxCols)
public int compareTo(Row other)
Row
compareTo
in interface Comparable<Row>
compareTo
in interface Row
public Get setAttribute(String name, byte[] value)
Attributes
setAttribute
in interface Attributes
setAttribute
in class OperationWithAttributes
name
- attribute namevalue
- attribute valuepublic Get setId(String id)
OperationWithAttributes
setId
in class OperationWithAttributes
public Get setAuthorizations(Authorizations authorizations)
Query
setAuthorizations
in class Query
public Get setACL(Map<String,Permission> perms)
Query
public Get setACL(String user, Permission perms)
Query
public Get setConsistency(Consistency consistency)
Query
setConsistency
in class Query
consistency
- the consistency levelpublic Get setReplicaId(int Id)
Query
Query.setConsistency(Consistency)
passing Consistency.TIMELINE
to read data from a
specific replicaId. setReplicaId
in class Query
public Get setIsolationLevel(IsolationLevel level)
Query
setIsolationLevel
in class Query
level
- IsolationLevel for this querypublic Get setPriority(int priority)
setPriority
in class OperationWithAttributes
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.