Package org.apache.hadoop.hbase.client
Class Mutation
java.lang.Object
org.apache.hadoop.hbase.client.Operation
org.apache.hadoop.hbase.client.OperationWithAttributes
org.apache.hadoop.hbase.client.Mutation
- All Implemented Interfaces:
Comparable<Row>
,CellScannable
,Attributes
,Row
,HeapSize
@Public
public abstract class Mutation
extends OperationWithAttributes
implements Row, CellScannable, HeapSize
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprivate static final String
The attribute for storing the list of clusters that have consumed the change.protected Durability
protected NavigableMap<byte[],
List<Cell>> static final long
private static final String
The attribute for storing TTL for the result of the mutation.private static final String
protected byte[]
protected long
Fields inherited from class org.apache.hadoop.hbase.client.OperationWithAttributes
ID_ATRIBUTE
Fields inherited from interface org.apache.hadoop.hbase.client.Row
COMPARATOR
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription(package private) Mutation
Returns A CellScanner over the containedCell
s(package private) static byte[]
checkRow
(byte[] row) (package private) static byte[]
checkRow
(byte[] row, int offset, int length) (package private) static void
checkRow
(ByteBuffer row) int
Deprecated.As of release 2.0.0, this will be removed in HBase 3.0.0.(package private) KeyValue
createPutKeyValue
(byte[] family, byte[] qualifier, long ts, byte[] value) Create a KeyValue with this objects row key and the Put identifier.(package private) KeyValue
createPutKeyValue
(byte[] family, byte[] qualifier, long ts, byte[] value, Tag[] tags) Create a KeyValue with this objects row key and the Put identifier.(package private) KeyValue
createPutKeyValue
(byte[] family, ByteBuffer qualifier, long ts, ByteBuffer value, Tag[] tags) Create a KeyValue with this objects row key and the Put identifier.protected long
Subclasses should override this method to add the heap size of their own fields.get
(byte[] family, byte[] qualifier) Returns a list of all KeyValue objects with matching column family and qualifier.byte[]
getACL()
Returns The serialized ACL for this operation, or null if nonegetCellList
(byte[] family) Creates an empty list if one doesn't exist for the given column family or else it returns the associated list of Cell objects.Returns CellVisibility associated with cells in this Mutation.Returns the set of clusterIds that have consumed the mutationGet the current durabilityNavigableMap<byte[],
List<Cell>> Method for retrieving the put's familyMapCompile the column family (i.e.byte[]
getRow()
Method for retrieving the delete's rowlong
Method for retrieving the timestamp.long
Deprecated.As of release 2.0.0, this will be removed in HBase 3.0.0.long
getTTL()
Return the TTL requested for the result of the mutation, in milliseconds.boolean
has
(byte[] family, byte[] qualifier) A convenience method to determine if this object's familyMap contains a value assigned to the given family & qualifier.boolean
has
(byte[] family, byte[] qualifier, byte[] value) A convenience method to determine if this object's familyMap contains a value assigned to the given family, qualifier and timestamp.boolean
has
(byte[] family, byte[] qualifier, long ts) A convenience method to determine if this object's familyMap contains a value assigned to the given family, qualifier and timestamp.boolean
has
(byte[] family, byte[] qualifier, long ts, byte[] value) A convenience method to determine if this object's familyMap contains the given value assigned to the given family, qualifier and timestamp.protected boolean
has
(byte[] family, byte[] qualifier, long ts, byte[] value, boolean ignoreTS, boolean ignoreValue) Private method to determine if this object's familyMap contains the given value assigned to the given family, qualifier and timestamp, respecting the 2 boolean arguments.long
heapSize()
Returns Calculate what Mutation adds to class heap size.boolean
isEmpty()
Method to check if the familyMap is emptyprotected boolean
Returns current value for returnResultsint
Returns the number of different familiessetACL
(String user, Permission perms) Set the ACL for this operation.setACL
(Map<String, Permission> perms) Set the ACL for this operation.setCellVisibility
(CellVisibility expression) Sets the visibility expression associated with cells in this Mutation.setClusterIds
(List<UUID> clusterIds) Marks that the clusters with the given clusterIds have consumed the mutationSet the durability for this mutationsetFamilyCellMap
(NavigableMap<byte[], List<Cell>> map) Deprecated.As of release 2.0.0, this will be removed in HBase 3.0.0.protected Mutation
setReturnResults
(boolean returnResults) setTimestamp
(long timestamp) Set the timestamp of the delete.setTTL
(long ttl) Set the TTL desired for the result of the mutation, in milliseconds.int
size()
Number of KeyValues carried by this Mutation.private static CellVisibility
toCellVisibility
(byte[] protoBytes) Convert a protocol buffer CellVisibility bytes to a client CellVisibilityprivate static CellVisibility
toCellVisibility
(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CellVisibility proto) Convert a protocol buffer CellVisibility to a client CellVisibility(package private) static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CellVisibility
toCellVisibility
(CellVisibility cellVisibility) Create a protocol buffer CellVisibility based on a client CellVisibility.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.OperationWithAttributes
getAttribute, getAttributeSize, getAttributesMap, getId, getPriority, setAttribute, setId, setPriority
-
Field Details
-
MUTATION_OVERHEAD
-
CONSUMED_CLUSTER_IDS
The attribute for storing the list of clusters that have consumed the change.- See Also:
-
OP_ATTRIBUTE_TTL
The attribute for storing TTL for the result of the mutation.- See Also:
-
RETURN_RESULTS
- See Also:
-
row
-
ts
-
durability
-
familyMap
-
-
Constructor Details
-
Mutation
protected Mutation()empty construction. We need this empty construction to keep binary compatibility. -
Mutation
-
-
Method Details
-
cellScanner
Description copied from interface:CellScannable
Returns A CellScanner over the containedCell
s- Specified by:
cellScanner
in interfaceCellScannable
-
getCellList
Creates an empty list if one doesn't exist for the given column family or else it returns the associated list of Cell objects.- Parameters:
family
- column family- Returns:
- a list of Cell objects, returns an empty list if one doesn't exist.
-
createPutKeyValue
Create a KeyValue with this objects row key and the Put identifier.- Returns:
- a KeyValue with this objects row key and the Put identifier.
-
createPutKeyValue
Create a KeyValue with this objects row key and the Put identifier.- Returns:
- a KeyValue with this objects row key and the Put identifier.
-
createPutKeyValue
KeyValue createPutKeyValue(byte[] family, ByteBuffer qualifier, long ts, ByteBuffer value, Tag[] tags) Create a KeyValue with this objects row key and the Put identifier.- Returns:
- a KeyValue with this objects row key and the Put identifier.
-
getFingerprint
Compile the column family (i.e. schema) information into a Map. Useful for parsing and aggregation by debugging, logging, and administration tools.- Specified by:
getFingerprint
in 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. -
cellToStringMap
-
setDurability
Set the durability for this mutation -
getDurability
Get the current durability -
getFamilyCellMap
Method for retrieving the put's familyMap -
isEmpty
Method to check if the familyMap is empty- Returns:
- true if empty, false otherwise
-
getRow
Method for retrieving the delete's row -
compareTo
Deprecated.As of release 2.0.0, this will be removed in HBase 3.0.0. UseRow.COMPARATOR
insteadDescription copied from interface:Row
Compare this row to another row.- Specified by:
compareTo
in interfaceComparable<Row>
- Specified by:
compareTo
in interfaceRow
-
getTimeStamp
Deprecated.As of release 2.0.0, this will be removed in HBase 3.0.0. UsegetTimestamp()
insteadMethod for retrieving the timestamp -
getTimestamp
Method for retrieving the timestamp. -
setClusterIds
Marks that the clusters with the given clusterIds have consumed the mutation- Parameters:
clusterIds
- of the clusters that have consumed the mutation
-
getClusterIds
Returns the set of clusterIds that have consumed the mutation -
setCellVisibility
Sets the visibility expression associated with cells in this Mutation. -
getCellVisibility
Returns CellVisibility associated with cells in this Mutation. n- Throws:
DeserializationException
-
toCellVisibility
static org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CellVisibility toCellVisibility(CellVisibility cellVisibility) Create a protocol buffer CellVisibility based on a client CellVisibility.- Returns:
- a protocol buffer CellVisibility
-
toCellVisibility
private static CellVisibility toCellVisibility(org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CellVisibility proto) Convert a protocol buffer CellVisibility to a client CellVisibility- Returns:
- the converted client CellVisibility
-
toCellVisibility
Convert a protocol buffer CellVisibility bytes to a client CellVisibility- Returns:
- the converted client CellVisibility
- Throws:
DeserializationException
-
size
Number of KeyValues carried by this Mutation.- Returns:
- the total number of KeyValues
-
numFamilies
Returns the number of different families -
heapSize
Returns Calculate what Mutation adds to class heap size. -
getACL
Returns The serialized ACL for this operation, or null if none -
setACL
Set the ACL for this operation.- Parameters:
user
- User short nameperms
- Permissions for the user
-
setACL
Set the ACL for this operation.- Parameters:
perms
- A map of permissions for a user or users
-
getTTL
Return the TTL requested for the result of the mutation, in milliseconds.- Returns:
- the TTL requested for the result of the mutation, in milliseconds, or Long.MAX_VALUE if unset
-
setTTL
Set the TTL desired for the result of the mutation, in milliseconds.- Parameters:
ttl
- the TTL desired for the result of the mutation, in milliseconds
-
isReturnResults
Returns current value for returnResults -
setReturnResults
-
extraHeapSize
Subclasses should override this method to add the heap size of their own fields.- Returns:
- the heap size to add (will be aligned).
-
setTimestamp
Set the timestamp of the delete. -
has
A convenience method to determine if this object's familyMap contains a value assigned to the given family & qualifier. Both given arguments must match the KeyValue object to return true.- Parameters:
family
- column familyqualifier
- column qualifier- Returns:
- returns true if the given family and qualifier already has an existing KeyValue object in the family map.
-
has
A convenience method to determine if this object's familyMap contains a value assigned to the given family, qualifier and timestamp. All 3 given arguments must match the KeyValue object to return true.- Parameters:
family
- column familyqualifier
- column qualifierts
- timestamp- Returns:
- returns true if the given family, qualifier and timestamp already has an existing KeyValue object in the family map.
-
has
A convenience method to determine if this object's familyMap contains a value assigned to the given family, qualifier and timestamp. All 3 given arguments must match the KeyValue object to return true.- Parameters:
family
- column familyqualifier
- column qualifiervalue
- value to check- Returns:
- returns true if the given family, qualifier and value already has an existing KeyValue object in the family map.
-
has
A convenience method to determine if this object's familyMap contains the given value assigned to the given family, qualifier and timestamp. All 4 given arguments must match the KeyValue object to return true.- Parameters:
family
- column familyqualifier
- column qualifierts
- timestampvalue
- value to check- Returns:
- returns true if the given family, qualifier timestamp and value already has an existing KeyValue object in the family map.
-
get
Returns a list of all KeyValue objects with matching column family and qualifier.- Parameters:
family
- column familyqualifier
- column qualifier- Returns:
- a list of KeyValue objects with the matching family and qualifier, returns an empty list if one doesn't exist for the given family.
-
has
protected boolean has(byte[] family, byte[] qualifier, long ts, byte[] value, boolean ignoreTS, boolean ignoreValue) Private method to determine if this object's familyMap contains the given value assigned to the given family, qualifier and timestamp, respecting the 2 boolean arguments. -
checkRow
- Parameters:
row
- Row to check- Returns:
row
- Throws:
IllegalArgumentException
- Thrown ifrow
is empty or null or >HConstants.MAX_ROW_LENGTH
-
checkRow
- Parameters:
row
- Row to check- Returns:
row
- Throws:
IllegalArgumentException
- Thrown ifrow
is empty or null or >HConstants.MAX_ROW_LENGTH
-
checkRow
-
add
- Throws:
IOException
-