Class Delete

All Implemented Interfaces:
Comparable<Row>, CellScannable, Attributes, Row, HeapSize

@Public public class Delete extends Mutation
Used to perform Delete operations on a single row.

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.

  • Constructor Details

    • Delete

      public Delete(byte[] row)
      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

      public Delete(byte[] row, long timestamp)
      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 key
      timestamp - maximum version timestamp (only for delete row)
    • Delete

      public Delete(byte[] row, int rowOffset, int rowLength)
      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

      public Delete(byte[] row, int rowOffset, int rowLength, long timestamp)
      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

      public Delete(Delete deleteToCopy)
      Create a Delete operation using another Delete as template.
      Parameters:
      deleteToCopy - delete to copy
    • Delete

      public Delete(byte[] row, long ts, NavigableMap<byte[],List<Cell>> familyMap)
      Construct the Delete with user defined data. NOTED: 1) all cells in the familyMap must have the delete type. see Cell.Type 2) the row of each cell must be same with passed row.
      Parameters:
      row - row. CAN'T be null
      ts - timestamp
      familyMap - the map to collect all cells internally. CAN'T be null
  • Method Details

    • addDeleteMarker

      Deprecated.
      As of release 2.0.0, this will be removed in HBase 3.0.0. Use add(Cell) instead
      Advanced use only. Add an existing delete marker to this Delete object.
      Parameters:
      kv - An existing KeyValue of type "delete".
      Returns:
      this for invocation chaining
      Throws:
      IOException
    • add

      public Delete add(Cell cell) throws IOException
      Add an existing delete marker to this Delete object.
      Overrides:
      add in class Mutation
      Parameters:
      cell - An existing cell of type "delete".
      Returns:
      this for invocation chaining
      Throws:
      IOException
    • addFamily

      public Delete addFamily(byte[] family)
      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

      public Delete addFamily(byte[] family, long timestamp)
      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 name
      timestamp - maximum version timestamp
      Returns:
      this for invocation chaining
    • addFamilyVersion

      public Delete addFamilyVersion(byte[] family, long timestamp)
      Delete all columns of the specified family with a timestamp equal to the specified timestamp.
      Parameters:
      family - family name
      timestamp - version timestamp
      Returns:
      this for invocation chaining
    • addColumns

      public Delete addColumns(byte[] family, byte[] qualifier)
      Delete all versions of the specified column.
      Parameters:
      family - family name
      qualifier - column qualifier
      Returns:
      this for invocation chaining
    • addColumns

      public Delete 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.
      Parameters:
      family - family name
      qualifier - column qualifier
      timestamp - maximum version timestamp
      Returns:
      this for invocation chaining
    • addColumn

      public Delete addColumn(byte[] family, byte[] qualifier)
      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 name
      qualifier - column qualifier
      Returns:
      this for invocation chaining
    • addColumn

      public Delete addColumn(byte[] family, byte[] qualifier, long timestamp)
      Delete the specified version of the specified column.
      Parameters:
      family - family name
      qualifier - column qualifier
      timestamp - version timestamp
      Returns:
      this for invocation chaining
    • setTimestamp

      public Delete setTimestamp(long timestamp)
      Description copied from class: Mutation
      Set the timestamp of the delete.
      Overrides:
      setTimestamp in class Mutation
    • setAttribute

      public Delete setAttribute(String name, byte[] value)
      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 interface Attributes
      Overrides:
      setAttribute in class OperationWithAttributes
      Parameters:
      name - attribute name
      value - attribute value
    • setId

      public Delete setId(String id)
      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 class OperationWithAttributes
    • setDurability

      Description copied from class: Mutation
      Set the durability for this mutation
      Overrides:
      setDurability in class Mutation
    • setFamilyCellMap

      Deprecated.
      As of release 2.0.0, this will be removed in HBase 3.0.0. Use Delete(byte[], long, NavigableMap) instead
      Method for setting the Delete's familyMap
      Overrides:
      setFamilyCellMap in class Mutation
    • setClusterIds

      public Delete setClusterIds(List<UUID> clusterIds)
      Description copied from class: Mutation
      Marks that the clusters with the given clusterIds have consumed the mutation
      Overrides:
      setClusterIds in class Mutation
      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 class Mutation
    • setACL

      public Delete setACL(String user, Permission perms)
      Description copied from class: Mutation
      Set the ACL for this operation.
      Overrides:
      setACL in class Mutation
      Parameters:
      user - User short name
      perms - Permissions for the user
    • setACL

      public Delete setACL(Map<String,Permission> perms)
      Description copied from class: Mutation
      Set the ACL for this operation.
      Overrides:
      setACL in class Mutation
      Parameters:
      perms - A map of permissions for a user or users
    • setTTL

      public Delete setTTL(long ttl)
      Description copied from class: Mutation
      Set the TTL desired for the result of the mutation, in milliseconds.
      Overrides:
      setTTL in class Mutation
      Parameters:
      ttl - the TTL desired for the result of the mutation, in milliseconds
    • setPriority

      public Delete setPriority(int priority)
      Overrides:
      setPriority in class OperationWithAttributes