Class Mutation
- All Implemented Interfaces:
- org.apache.hadoop.io.Writable
- Direct Known Subclasses:
- ConditionalMutation
Convenience methods which takes columns and value as CharSequence (String implements CharSequence) are provided. CharSequence is converted to UTF-8 by constructing a new Text object.
When always passing in the same data as a CharSequence/String, it's probably more efficient to call the Text put methods. This way the data is only encoded once and only one Text object is created.
All of the put methods append data to the mutation; they do not overwrite anything that was previously put. The mutation holds a list of all columns/values that were put into it.
The putDelete() methods do not remove something that was previously added to the mutation; rather, they indicate that Accumulo should insert a delete marker for that row column. A delete marker effectively hides entries for that row column with a timestamp earlier than the marker's. (The hidden data is eventually removed during Accumulo garbage collection.)
 This class has many overloaded put and putDelete methods. These were added to
 support different subset of fields and types. The functionality of all of these put
 methods and more is provided by the new fluent at() method added in 2.0.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic interfaceProvides methods for setting the column family of a Mutation.static interfaceProvides methods for setting the value of a Mutation.static interfaceProvides methods for setting the column qualifier of a Mutation.static enumFormats available for serializing Mutations.static interfaceProvides methods for setting the timestamp of a Mutation.static interfaceProvides methods for setting the column visibility of a Mutation.
- 
Constructor SummaryConstructorsConstructorDescriptionMutation()Creates a new mutation.Mutation(byte[] row) Creates a new mutation.Mutation(byte[] row, int initialBufferSize) Creates a new mutation.Mutation(byte[] row, int start, int length) Creates a new mutation.Mutation(byte[] row, int start, int length, int initialBufferSize) Creates a new mutation.Mutation(CharSequence row) Creates a new mutation.Mutation(CharSequence row, int initialBufferSize) Creates a new mutation.Creates a new mutation by copying another.Mutation(org.apache.accumulo.core.dataImpl.thrift.TMutation tmutation) Creates a new mutation from a Thrift mutation.Mutation(org.apache.hadoop.io.Text row) Creates a new mutation.Mutation(org.apache.hadoop.io.Text row, int initialBufferSize) Creates a new mutation.
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddReplicationSource(String peer) Deprecated.The feature pertaining to this method was deprecated in 2.1.0, but this method was overlooked when annotating the code.at()Fluent API for putting or deleting to a Mutation that makes it easy use different types (i.e byte[], CharSequence, etc) when specifying the family, qualifier, value, etc.protected voiddroppingOldTimestamp(long ts) booleanbooleanChecks if this mutation equals another.longGets an estimate of the amount of memory used by this mutation.Deprecated.The feature pertaining to this method was deprecated in 2.1.0, but this method was overlooked when annotating the code.byte[]getRow()Gets the row ID for this mutation.protected Mutation.SERIALIZED_FORMATGets the serialization format used to (de)serialize this mutation.Gets the modifications and deletions in this mutation.inthashCode()protected ColumnUpdatenewColumnUpdate(byte[] cf, byte[] cq, byte[] cv, boolean hasts, long ts, boolean deleted, byte[] val) longnumBytes()Gets the total number of bytes in this mutation.Creates a multi-lined, human-readable String for this mutation.voidput(byte[] columnFamily, byte[] columnQualifier, byte[] value) Puts a modification in this mutation.voidput(byte[] columnFamily, byte[] columnQualifier, long timestamp, byte[] value) Puts a modification in this mutation.voidput(byte[] columnFamily, byte[] columnQualifier, ColumnVisibility columnVisibility, byte[] value) Puts a modification in this mutation.voidput(byte[] columnFamily, byte[] columnQualifier, ColumnVisibility columnVisibility, long timestamp, byte[] value) Puts a modification in this mutation.voidput(CharSequence columnFamily, CharSequence columnQualifier, long timestamp, CharSequence value) Puts a modification in this mutation.voidput(CharSequence columnFamily, CharSequence columnQualifier, long timestamp, Value value) Puts a modification in this mutation.voidput(CharSequence columnFamily, CharSequence columnQualifier, CharSequence value) Puts a modification in this mutation.voidput(CharSequence columnFamily, CharSequence columnQualifier, Value value) Puts a modification in this mutation.voidput(CharSequence columnFamily, CharSequence columnQualifier, ColumnVisibility columnVisibility, long timestamp, CharSequence value) Puts a modification in this mutation.voidput(CharSequence columnFamily, CharSequence columnQualifier, ColumnVisibility columnVisibility, long timestamp, Value value) Puts a modification in this mutation.voidput(CharSequence columnFamily, CharSequence columnQualifier, ColumnVisibility columnVisibility, CharSequence value) Puts a modification in this mutation.voidput(CharSequence columnFamily, CharSequence columnQualifier, ColumnVisibility columnVisibility, Value value) Puts a modification in this mutation.voidput(org.apache.hadoop.io.Text columnFamily, org.apache.hadoop.io.Text columnQualifier, long timestamp, Value value) Puts a modification in this mutation.voidPuts a modification in this mutation.voidput(org.apache.hadoop.io.Text columnFamily, org.apache.hadoop.io.Text columnQualifier, ColumnVisibility columnVisibility, long timestamp, Value value) Puts a modification in this mutation.voidput(org.apache.hadoop.io.Text columnFamily, org.apache.hadoop.io.Text columnQualifier, ColumnVisibility columnVisibility, Value value) Puts a modification in this mutation.voidputDelete(byte[] columnFamily, byte[] columnQualifier) Puts a deletion in this mutation.voidputDelete(byte[] columnFamily, byte[] columnQualifier, long timestamp) Puts a deletion in this mutation.voidputDelete(byte[] columnFamily, byte[] columnQualifier, ColumnVisibility columnVisibility) Puts a deletion in this mutation.voidputDelete(byte[] columnFamily, byte[] columnQualifier, ColumnVisibility columnVisibility, long timestamp) Puts a deletion in this mutation.voidputDelete(CharSequence columnFamily, CharSequence columnQualifier) Puts a deletion in this mutation.voidputDelete(CharSequence columnFamily, CharSequence columnQualifier, long timestamp) Puts a deletion in this mutation.voidputDelete(CharSequence columnFamily, CharSequence columnQualifier, ColumnVisibility columnVisibility) Puts a deletion in this mutation.voidputDelete(CharSequence columnFamily, CharSequence columnQualifier, ColumnVisibility columnVisibility, long timestamp) Puts a deletion in this mutation.voidputDelete(org.apache.hadoop.io.Text columnFamily, org.apache.hadoop.io.Text columnQualifier) Puts a deletion in this mutation.voidputDelete(org.apache.hadoop.io.Text columnFamily, org.apache.hadoop.io.Text columnQualifier, long timestamp) Puts a deletion in this mutation.voidputDelete(org.apache.hadoop.io.Text columnFamily, org.apache.hadoop.io.Text columnQualifier, ColumnVisibility columnVisibility) Puts a deletion in this mutation.voidputDelete(org.apache.hadoop.io.Text columnFamily, org.apache.hadoop.io.Text columnQualifier, ColumnVisibility columnVisibility, long timestamp) Puts a deletion in this mutation.voidreadFields(DataInput in) voidsetReplicationSources(Set<String> sources) Deprecated.The feature pertaining to this method was deprecated in 2.1.0, but this method was overlooked when annotating the code.intsize()Gets the number of modifications / deletions in this mutation.org.apache.accumulo.core.dataImpl.thrift.TMutationtoThrift()Creates aTMutationobject containing this Mutation's data.voidwrite(DataOutput out) 
- 
Constructor Details- 
Mutationpublic Mutation(byte[] row) Creates a new mutation. A defensive copy is made.- Parameters:
- row- row ID
- Since:
- 1.5.0
 
- 
Mutationpublic Mutation(byte[] row, int initialBufferSize) Creates a new mutation. A defensive copy is made.- Parameters:
- row- row ID
- initialBufferSize- the initial size, in bytes, of the internal buffer for serializing
- Since:
- 1.7.0
 
- 
Mutationpublic Mutation(byte[] row, int start, int length) Creates a new mutation. A defensive copy is made.- Parameters:
- row- byte array containing row ID
- start- starting index of row ID in byte array
- length- length of row ID in byte array
- Throws:
- IndexOutOfBoundsException- if start or length is invalid
- Since:
- 1.5.0
 
- 
Mutationpublic Mutation(byte[] row, int start, int length, int initialBufferSize) Creates a new mutation. A defensive copy is made.- Parameters:
- row- byte array containing row ID
- start- starting index of row ID in byte array
- length- length of row ID in byte array
- initialBufferSize- the initial size, in bytes, of the internal buffer for serializing
- Throws:
- IndexOutOfBoundsException- if start or length is invalid
- Since:
- 1.7.0
 
- 
Mutationpublic Mutation(org.apache.hadoop.io.Text row) Creates a new mutation. A defensive copy is made.- Parameters:
- row- row ID
 
- 
Mutationpublic Mutation(org.apache.hadoop.io.Text row, int initialBufferSize) Creates a new mutation. A defensive copy is made.- Parameters:
- row- row ID
- initialBufferSize- the initial size, in bytes, of the internal buffer for serializing
- Since:
- 1.7.0
 
- 
MutationCreates a new mutation.- Parameters:
- row- row ID
 
- 
MutationCreates a new mutation.- Parameters:
- row- row ID
- initialBufferSize- the initial size, in bytes, of the internal buffer for serializing
- Since:
- 1.7.0
 
- 
Mutationpublic Mutation()Creates a new mutation.
- 
Mutationpublic Mutation(org.apache.accumulo.core.dataImpl.thrift.TMutation tmutation) Creates a new mutation from a Thrift mutation.- Parameters:
- tmutation- Thrift mutation
 
- 
MutationCreates a new mutation by copying another.- Parameters:
- m- mutation to copy
 
 
- 
- 
Method Details- 
getRowpublic byte[] getRow()Gets the row ID for this mutation. Not a defensive copy.- Returns:
- row ID
 
- 
putpublic void put(org.apache.hadoop.io.Text columnFamily, org.apache.hadoop.io.Text columnQualifier, Value value) Puts a modification in this mutation. Column visibility is empty; timestamp is not set. All parameters are defensively copied.- Parameters:
- columnFamily- column family
- columnQualifier- column qualifier
- value- cell value
- See Also:
 
- 
putpublic void put(org.apache.hadoop.io.Text columnFamily, org.apache.hadoop.io.Text columnQualifier, ColumnVisibility columnVisibility, Value value) Puts a modification in this mutation. Timestamp is not set. All parameters are defensively copied.- Parameters:
- columnFamily- column family
- columnQualifier- column qualifier
- columnVisibility- column visibility
- value- cell value
- See Also:
 
- 
putpublic void put(org.apache.hadoop.io.Text columnFamily, org.apache.hadoop.io.Text columnQualifier, long timestamp, Value value) Puts a modification in this mutation. Column visibility is empty. All appropriate parameters are defensively copied.- Parameters:
- columnFamily- column family
- columnQualifier- column qualifier
- timestamp- timestamp
- value- cell value
- See Also:
 
- 
putpublic void put(org.apache.hadoop.io.Text columnFamily, org.apache.hadoop.io.Text columnQualifier, ColumnVisibility columnVisibility, long timestamp, Value value) Puts a modification in this mutation. All appropriate parameters are defensively copied.- Parameters:
- columnFamily- column family
- columnQualifier- column qualifier
- columnVisibility- column visibility
- timestamp- timestamp
- value- cell value
- See Also:
 
- 
putDeletepublic void putDelete(org.apache.hadoop.io.Text columnFamily, org.apache.hadoop.io.Text columnQualifier) Puts a deletion in this mutation. Matches empty column visibility; timestamp is not set. All parameters are defensively copied.- Parameters:
- columnFamily- column family
- columnQualifier- column qualifier
- See Also:
 
- 
putDeletepublic void putDelete(org.apache.hadoop.io.Text columnFamily, org.apache.hadoop.io.Text columnQualifier, ColumnVisibility columnVisibility) Puts a deletion in this mutation. Timestamp is not set. All parameters are defensively copied.- Parameters:
- columnFamily- column family
- columnQualifier- column qualifier
- columnVisibility- column visibility
- See Also:
 
- 
putDeletepublic void putDelete(org.apache.hadoop.io.Text columnFamily, org.apache.hadoop.io.Text columnQualifier, long timestamp) Puts a deletion in this mutation. Matches empty column visibility. All appropriate parameters are defensively copied.- Parameters:
- columnFamily- column family
- columnQualifier- column qualifier
- timestamp- timestamp
- See Also:
 
- 
putDeletepublic void putDelete(org.apache.hadoop.io.Text columnFamily, org.apache.hadoop.io.Text columnQualifier, ColumnVisibility columnVisibility, long timestamp) Puts a deletion in this mutation. All appropriate parameters are defensively copied.- Parameters:
- columnFamily- column family
- columnQualifier- column qualifier
- columnVisibility- column visibility
- timestamp- timestamp
- See Also:
 
- 
putPuts a modification in this mutation. Column visibility is empty; timestamp is not set. All parameters are defensively copied.- Parameters:
- columnFamily- column family
- columnQualifier- column qualifier
- See Also:
 
- 
putpublic void put(CharSequence columnFamily, CharSequence columnQualifier, ColumnVisibility columnVisibility, Value value) Puts a modification in this mutation. Timestamp is not set. All parameters are defensively copied.- Parameters:
- columnFamily- column family
- columnQualifier- column qualifier
- columnVisibility- column visibility
- value- cell value
- See Also:
 
- 
putpublic void put(CharSequence columnFamily, CharSequence columnQualifier, long timestamp, Value value) Puts a modification in this mutation. Column visibility is empty. All appropriate parameters are defensively copied.- Parameters:
- columnFamily- column family
- columnQualifier- column qualifier
- timestamp- timestamp
- value- cell value
- See Also:
 
- 
putpublic void put(CharSequence columnFamily, CharSequence columnQualifier, ColumnVisibility columnVisibility, long timestamp, Value value) Puts a modification in this mutation. All appropriate parameters are defensively copied.- Parameters:
- columnFamily- column family
- columnQualifier- column qualifier
- columnVisibility- column visibility
- timestamp- timestamp
- value- cell value
- See Also:
 
- 
putDeletePuts a deletion in this mutation. Matches empty column visibility; timestamp is not set. All parameters are defensively copied.- Parameters:
- columnFamily- column family
- columnQualifier- column qualifier
- See Also:
 
- 
putDeletepublic void putDelete(CharSequence columnFamily, CharSequence columnQualifier, ColumnVisibility columnVisibility) Puts a deletion in this mutation. Timestamp is not set. All appropriate parameters are defensively copied.- Parameters:
- columnFamily- column family
- columnQualifier- column qualifier
- columnVisibility- column visibility
- See Also:
 
- 
putDeletePuts a deletion in this mutation. Matches empty column visibility. All appropriate parameters are defensively copied.- Parameters:
- columnFamily- column family
- columnQualifier- column qualifier
- timestamp- timestamp
- See Also:
 
- 
putDeletepublic void putDelete(CharSequence columnFamily, CharSequence columnQualifier, ColumnVisibility columnVisibility, long timestamp) Puts a deletion in this mutation. All appropriate parameters are defensively copied.- Parameters:
- columnFamily- column family
- columnQualifier- column qualifier
- columnVisibility- column visibility
- timestamp- timestamp
- See Also:
 
- 
putPuts a modification in this mutation. Column visibility is empty; timestamp is not set. All parameters are defensively copied.- Parameters:
- columnFamily- column family
- columnQualifier- column qualifier
- value- cell value
- See Also:
 
- 
putpublic void put(CharSequence columnFamily, CharSequence columnQualifier, ColumnVisibility columnVisibility, CharSequence value) Puts a modification in this mutation. Timestamp is not set. All parameters are defensively copied.- Parameters:
- columnFamily- column family
- columnQualifier- column qualifier
- columnVisibility- column visibility
- value- cell value
- See Also:
 
- 
putpublic void put(CharSequence columnFamily, CharSequence columnQualifier, long timestamp, CharSequence value) Puts a modification in this mutation. Column visibility is empty. All appropriate parameters are defensively copied.- Parameters:
- columnFamily- column family
- columnQualifier- column qualifier
- timestamp- timestamp
- value- cell value
- See Also:
 
- 
putpublic void put(CharSequence columnFamily, CharSequence columnQualifier, ColumnVisibility columnVisibility, long timestamp, CharSequence value) Puts a modification in this mutation. All appropriate parameters are defensively copied.- Parameters:
- columnFamily- column family
- columnQualifier- column qualifier
- columnVisibility- column visibility
- timestamp- timestamp
- value- cell value
- See Also:
 
- 
putpublic void put(byte[] columnFamily, byte[] columnQualifier, byte[] value) Puts a modification in this mutation. Column visibility is empty; timestamp is not set. All parameters are defensively copied.- Parameters:
- columnFamily- column family
- columnQualifier- column qualifier
- value- cell value
- Since:
- 1.5.0
- See Also:
 
- 
putpublic void put(byte[] columnFamily, byte[] columnQualifier, ColumnVisibility columnVisibility, byte[] value) Puts a modification in this mutation. Timestamp is not set. All parameters are defensively copied.- Parameters:
- columnFamily- column family
- columnQualifier- column qualifier
- columnVisibility- column visibility
- value- cell value
- Since:
- 1.5.0
- See Also:
 
- 
putpublic void put(byte[] columnFamily, byte[] columnQualifier, long timestamp, byte[] value) Puts a modification in this mutation. Column visibility is empty. All appropriate parameters are defensively copied.- Parameters:
- columnFamily- column family
- columnQualifier- column qualifier
- timestamp- timestamp
- value- cell value
- Since:
- 1.5.0
- See Also:
 
- 
putpublic void put(byte[] columnFamily, byte[] columnQualifier, ColumnVisibility columnVisibility, long timestamp, byte[] value) Puts a modification in this mutation. All appropriate parameters are defensively copied.- Parameters:
- columnFamily- column family
- columnQualifier- column qualifier
- columnVisibility- column visibility
- timestamp- timestamp
- value- cell value
- Since:
- 1.5.0
- See Also:
 
- 
putDeletepublic void putDelete(byte[] columnFamily, byte[] columnQualifier) Puts a deletion in this mutation. Matches empty column visibility; timestamp is not set. All parameters are defensively copied.- Parameters:
- columnFamily- column family
- columnQualifier- column qualifier
- Since:
- 1.5.0
- See Also:
 
- 
putDeletepublic void putDelete(byte[] columnFamily, byte[] columnQualifier, ColumnVisibility columnVisibility) Puts a deletion in this mutation. Timestamp is not set. All parameters are defensively copied.- Parameters:
- columnFamily- column family
- columnQualifier- column qualifier
- columnVisibility- column visibility
- Since:
- 1.5.0
- See Also:
 
- 
putDeletepublic void putDelete(byte[] columnFamily, byte[] columnQualifier, long timestamp) Puts a deletion in this mutation. Matches empty column visibility. All appropriate parameters are defensively copied.- Parameters:
- columnFamily- column family
- columnQualifier- column qualifier
- timestamp- timestamp
- Since:
- 1.5.0
- See Also:
 
- 
putDeletepublic void putDelete(byte[] columnFamily, byte[] columnQualifier, ColumnVisibility columnVisibility, long timestamp) Puts a deletion in this mutation. All appropriate parameters are defensively copied.- Parameters:
- columnFamily- column family
- columnQualifier- column qualifier
- columnVisibility- column visibility
- timestamp- timestamp
- Since:
- 1.5.0
- See Also:
 
- 
atFluent API for putting or deleting to a Mutation that makes it easy use different types (i.e byte[], CharSequence, etc) when specifying the family, qualifier, value, etc.Methods are optional but must follow this order: family, qualifier, visibility, timestamp. The put and delete methods end the chain and add the modification to the Mutation. The following is an example if using at()to put and delete. Notice how the example mixesStringandbyte[].Mutation m = new Mutation("row0017"); m.at().family("001").qualifier(new byte[] {0,1}).put("v99"); m.at().family("002").qualifier(new byte[] {0,1}).delete();- Returns:
- a new FamilyOptions object, starting the method chain
- Since:
- 2.0.0
 
- 
getUpdatesGets the modifications and deletions in this mutation. After calling this method, further modifications to this mutation are ignored. Changes made to the returned updates do not affect this mutation.- Returns:
- list of modifications and deletions
 
- 
newColumnUpdateprotected ColumnUpdate newColumnUpdate(byte[] cf, byte[] cq, byte[] cv, boolean hasts, long ts, boolean deleted, byte[] val) 
- 
numBytespublic long numBytes()Gets the total number of bytes in this mutation.- Returns:
- length of mutation in bytes
 
- 
estimatedMemoryUsedpublic long estimatedMemoryUsed()Gets an estimate of the amount of memory used by this mutation. The estimate includes data sizes and object overhead.- Returns:
- memory usage estimate
 
- 
sizepublic int size()Gets the number of modifications / deletions in this mutation.- Returns:
- the number of modifications / deletions
 
- 
addReplicationSourceDeprecated.The feature pertaining to this method was deprecated in 2.1.0, but this method was overlooked when annotating the code. It is being marked as deprecated in 2.1.1 in order to correct that oversight, and will be removed in 3.0.0 with the rest of the code pertaining to this feature.Add a new element to the set of peers which this Mutation originated from- Parameters:
- peer- the peer to add
- Since:
- 1.7.0
 
- 
setReplicationSourcesDeprecated.The feature pertaining to this method was deprecated in 2.1.0, but this method was overlooked when annotating the code. It is being marked as deprecated in 2.1.1 in order to correct that oversight, and will be removed in 3.0.0 with the rest of the code pertaining to this feature.Set the replication peers which this Mutation originated from- Parameters:
- sources- Set of peer names which have processed this update
- Since:
- 1.7.0
 
- 
getReplicationSourcesDeprecated.The feature pertaining to this method was deprecated in 2.1.0, but this method was overlooked when annotating the code. It is being marked as deprecated in 2.1.1 in order to correct that oversight, and will be removed in 3.0.0 with the rest of the code pertaining to this feature.Return the replication sources for this Mutation- Returns:
- An unmodifiable view of the replication sources
 
- 
readFields- Specified by:
- readFieldsin interface- org.apache.hadoop.io.Writable
- Throws:
- IOException
 
- 
droppingOldTimestampprotected void droppingOldTimestamp(long ts) 
- 
write- Specified by:
- writein interface- org.apache.hadoop.io.Writable
- Throws:
- IOException
 
- 
equals
- 
hashCodepublic int hashCode()
- 
equalsChecks if this mutation equals another. Two mutations are equal if they target the same row and have the same modifications and deletions, in order. This method may be removed in a future API revision in favor ofequals(Object). See ACCUMULO-1627 for more information.- Parameters:
- m- mutation to compare
- Returns:
- true if this mutation equals the other, false otherwise
 
- 
toThriftpublic org.apache.accumulo.core.dataImpl.thrift.TMutation toThrift()Creates aTMutationobject containing this Mutation's data. Note that this method will move the Mutation into a "serialized" state that will prevent users from adding more data via Mutation#put().- Returns:
- a thrift form of this Mutation
 
- 
getSerializedFormatGets the serialization format used to (de)serialize this mutation.- Returns:
- serialization format
 
- 
prettyPrintCreates a multi-lined, human-readable String for this mutation. This method creates many intermediate Strings and should not be used for large volumes of Mutations.- Returns:
- A multi-lined, human-readable String for this mutation.
- Since:
- 2.1.0
 
 
-