Class Delete
- All Implemented Interfaces:
CellScannable
,Attributes
,Row
,ExtendedCellScannable
,HeapSize
To delete an entire row, instantiate a Delete object with the row to delete. To further define the scope of what to delete, perform additional methods as outlined below.
To delete specific families, execute deleteFamily
for each family to
delete.
To delete multiple versions of specific columns, execute deleteColumns
for each column to delete.
To delete specific versions of specific columns, execute deleteColumn
for each column version to delete.
Specifying timestamps, deleteFamily and deleteColumns will delete all versions with a timestamp less than or equal to that passed. If no timestamp is specified, an entry is added with a timestamp of 'now' where 'now' is the servers's EnvironmentEdgeManager.currentTime(). Specifying a timestamp to the deleteColumn method will delete versions only with a timestamp equal to that specified. If no timestamp is passed to deleteColumn, internally, it figures the most recent cell's timestamp and adds a delete at that timestamp; i.e. it deletes the most recently added cell.
The timestamp passed to the constructor is used ONLY for delete of rows. For anything less -- a deleteColumn, deleteColumns or deleteFamily -- then you need to use the method overrides that take a timestamp. The constructor timestamp is not referenced.
-
Field Summary
Fields inherited from class org.apache.hadoop.hbase.client.Mutation
durability, familyMap, MUTATION_OVERHEAD, row, ts
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
ConstructorDescriptionDelete
(byte[] row) Create a Delete operation for the specified row.Delete
(byte[] row, int rowOffset, int rowLength) Create a Delete operation for the specified row and timestamp.Delete
(byte[] row, int rowOffset, int rowLength, long timestamp) Create a Delete operation for the specified row and timestamp.Delete
(byte[] row, long timestamp) Create a Delete operation for the specified row and timestamp.Delete
(byte[] row, long ts, NavigableMap<byte[], List<Cell>> familyMap) Construct the Delete with user defined data.Create a Delete operation using another Delete as template. -
Method Summary
Modifier and TypeMethodDescriptionAdd an existing delete marker to this Delete object.addColumn
(byte[] family, byte[] qualifier) Delete the latest version of the specified column.addColumn
(byte[] family, byte[] qualifier, long timestamp) Delete the specified version of the specified column.addColumns
(byte[] family, byte[] qualifier) Delete all versions of the specified column.addColumns
(byte[] family, byte[] qualifier, long timestamp) Delete all versions of the specified column with a timestamp less than or equal to the specified timestamp.addFamily
(byte[] family) Delete all versions of all columns of the specified family.addFamily
(byte[] family, long timestamp) Delete all columns of the specified family with a timestamp less than or equal to the specified timestamp.addFamilyVersion
(byte[] family, long timestamp) Delete all columns of the specified family with a timestamp equal to the specified timestamp.get a CellBuilder instance that already has relevant Type and Row set.setACL
(String user, Permission perms) Set the ACL for this operation.setACL
(Map<String, Permission> perms) Set the ACL for this operation.setAttribute
(String name, byte[] value) Sets an attribute.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 mutationThis method allows you to set an identifier on an operation.setPriority
(int priority) setTimestamp
(long timestamp) Set the timestamp of the delete.setTTL
(long ttl) Set the TTL desired for the result of the mutation, in milliseconds.Methods inherited from class org.apache.hadoop.hbase.client.Mutation
cellScanner, checkRow, checkRow, checkRow, checkTimestamp, createPutKeyValue, createPutKeyValue, createPutKeyValue, extraHeapSize, get, getACL, getCellBuilder, getCellBuilder, getCellList, getCellVisibility, getClusterIds, getDurability, getFamilyCellMap, getFingerprint, getRow, getTimestamp, getTTL, has, has, has, has, has, heapSize, isEmpty, isReturnResults, numFamilies, setReturnResults, size, toCellVisibility, toMap
Methods inherited from class org.apache.hadoop.hbase.client.OperationWithAttributes
getAttribute, getAttributeSize, getAttributesMap, getId, getPriority
-
Constructor Details
-
Delete
Create a Delete operation for the specified row.If no further operations are done, this will delete everything associated with the specified row (all versions of all columns in all families), with timestamp from current point in time to the past. Cells defining timestamp for a future point in time (timestamp > current time) will not be deleted.
- Parameters:
row
- row key
-
Delete
Create a Delete operation for the specified row and timestamp.If no further operations are done, this will delete all columns in all families of the specified row with a timestamp less than or equal to the specified timestamp.
This timestamp is ONLY used for a delete row operation. If specifying families or columns, you must specify each timestamp individually.
- Parameters:
row
- row keytimestamp
- maximum version timestamp (only for delete row)
-
Delete
Create a Delete operation for the specified row and timestamp.If no further operations are done, this will delete all columns in all families of the specified row with a timestamp less than or equal to the specified timestamp.
This timestamp is ONLY used for a delete row operation. If specifying families or columns, you must specify each timestamp individually.
- Parameters:
row
- We make a local copy of this passed in row.
-
Delete
Create a Delete operation for the specified row and timestamp.If no further operations are done, this will delete all columns in all families of the specified row with a timestamp less than or equal to the specified timestamp.
This timestamp is ONLY used for a delete row operation. If specifying families or columns, you must specify each timestamp individually.
-
Delete
Create a Delete operation using another Delete as template.- Parameters:
deleteToCopy
- delete to copy
-
-
Method Details
-
add
Add an existing delete marker to this Delete object.- Overrides:
add
in classMutation
- Parameters:
cell
- An existing cell of type "delete".- Returns:
- this for invocation chaining
- Throws:
IOException
-
addFamily
Delete all versions of all columns of the specified family.Overrides previous calls to deleteColumn and deleteColumns for the specified family.
- Parameters:
family
- family name- Returns:
- this for invocation chaining
-
addFamily
Delete all columns of the specified family with a timestamp less than or equal to the specified timestamp.Overrides previous calls to deleteColumn and deleteColumns for the specified family.
- Parameters:
family
- family nametimestamp
- maximum version timestamp- Returns:
- this for invocation chaining
-
addFamilyVersion
Delete all columns of the specified family with a timestamp equal to the specified timestamp.- Parameters:
family
- family nametimestamp
- version timestamp- Returns:
- this for invocation chaining
-
addColumns
Delete all versions of the specified column.- Parameters:
family
- family namequalifier
- column qualifier- Returns:
- this for invocation chaining
-
addColumns
Delete all versions of the specified column with a timestamp less than or equal to the specified timestamp.- Parameters:
family
- family namequalifier
- column qualifiertimestamp
- maximum version timestamp- Returns:
- this for invocation chaining
-
addColumn
Delete the latest version of the specified column. This is an expensive call in that on the server-side, it first does a get to find the latest versions timestamp. Then it adds a delete using the fetched cells timestamp.- Parameters:
family
- family namequalifier
- column qualifier- Returns:
- this for invocation chaining
-
addColumn
Delete the specified version of the specified column.- Parameters:
family
- family namequalifier
- column qualifiertimestamp
- version timestamp- Returns:
- this for invocation chaining
-
setTimestamp
Description copied from class:Mutation
Set the timestamp of the delete.- Overrides:
setTimestamp
in classMutation
-
setAttribute
Description copied from interface:Attributes
Sets an attribute. In case value = null attribute is removed from the attributes map. Attribute names starting with _ indicate system attributes.- Specified by:
setAttribute
in interfaceAttributes
- Overrides:
setAttribute
in classOperationWithAttributes
- Parameters:
name
- attribute namevalue
- attribute value
-
setId
Description copied from class:OperationWithAttributes
This 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:
setId
in classOperationWithAttributes
-
setDurability
Description copied from class:Mutation
Set the durability for this mutation- Overrides:
setDurability
in classMutation
-
setClusterIds
Description copied from class:Mutation
Marks that the clusters with the given clusterIds have consumed the mutation- Overrides:
setClusterIds
in classMutation
- Parameters:
clusterIds
- of the clusters that have consumed the mutation
-
setCellVisibility
Description copied from class:Mutation
Sets the visibility expression associated with cells in this Mutation.- Overrides:
setCellVisibility
in classMutation
-
setACL
Description copied from class:Mutation
Set the ACL for this operation. -
setACL
Description copied from class:Mutation
Set the ACL for this operation. -
setTTL
Description copied from class:Mutation
Set the TTL desired for the result of the mutation, in milliseconds. -
setPriority
- Overrides:
setPriority
in classOperationWithAttributes
-
getCellBuilder
Description copied from class:Mutation
get a CellBuilder instance that already has relevant Type and Row set.- Specified by:
getCellBuilder
in classMutation
- Parameters:
type
- e.g CellBuilderType.SHALLOW_COPY- Returns:
- CellBuilder which already has relevant Type and Row set.
-