Class Put

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

@Public public class Put extends Mutation implements HeapSize
Used to perform Put operations for a single row.

To perform a Put, instantiate a Put object with the row to insert to, and for each column to be inserted, execute add or add if setting the timestamp.

  • Constructor Details

    • Put

      public Put(byte[] row)
      Create a Put operation for the specified row.
      Parameters:
      row - row key
    • Put

      public Put(byte[] row, long ts)
      Create a Put operation for the specified row, using a given timestamp.
      Parameters:
      row - row key; we make a copy of what we are passed to keep local.
      ts - timestamp
    • Put

      public Put(byte[] rowArray, int rowOffset, int rowLength)
      We make a copy of the passed in row key to keep local.
    • Put

      public Put(ByteBuffer row, long ts)
      Parameters:
      row - row key; we make a copy of what we are passed to keep local.
      ts - timestamp
    • Put

      public Put(ByteBuffer row)
      Parameters:
      row - row key; we make a copy of what we are passed to keep local.
    • Put

      public Put(byte[] rowArray, int rowOffset, int rowLength, long ts)
      We make a copy of the passed in row key to keep local.
    • Put

      public Put(byte[] row, boolean rowIsImmutable)
      Create a Put operation for an immutable row key.
      Parameters:
      row - row key
      rowIsImmutable - whether the input row is immutable. Set to true if the caller can guarantee that the row will not be changed for the Put duration.
    • Put

      public Put(byte[] row, long ts, boolean rowIsImmutable)
      Create a Put operation for an immutable row key, using a given timestamp.
      Parameters:
      row - row key
      ts - timestamp
      rowIsImmutable - whether the input row is immutable. Set to true if the caller can guarantee that the row will not be changed for the Put duration.
    • Put

      public Put(Put putToCopy)
      Copy constructor. Creates a Put operation cloned from the specified Put.
      Parameters:
      putToCopy - put to copy
    • Put

      public Put(byte[] row, long ts, NavigableMap<byte[],List<Cell>> familyMap)
      Construct the Put with user defined data. NOTED: 1) all cells in the familyMap must have the Type.Put 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

    • addColumn

      public Put addColumn(byte[] family, byte[] qualifier, byte[] value)
      Add the specified column and value to this Put operation.
      Parameters:
      family - family name
      qualifier - column qualifier
      value - column value
    • addImmutable

      @Deprecated public Put addImmutable(byte[] family, byte[] qualifier, byte[] value)
      Deprecated.
      As of release 2.0.0, this will be removed in HBase 3.0.0. Use add(Cell) and CellBuilder instead
      See addColumn(byte[], byte[], byte[]). This version expects that the underlying arrays won't change. It's intended for usage internal HBase to and for advanced client applications.
    • addColumn

      public Put addColumn(byte[] family, byte[] qualifier, long ts, byte[] value)
      Add the specified column and value, with the specified timestamp as its version to this Put operation.
      Parameters:
      family - family name
      qualifier - column qualifier
      ts - version timestamp
      value - column value
    • addImmutable

      @Deprecated public Put addImmutable(byte[] family, byte[] qualifier, long ts, byte[] value)
      Deprecated.
      As of release 2.0.0, this will be removed in HBase 3.0.0. Use add(Cell) and CellBuilder instead
      See addColumn(byte[], byte[], long, byte[]). This version expects that the underlying arrays won't change. It's intended for usage internal HBase to and for advanced client applications.
    • addColumn

      public Put addColumn(byte[] family, ByteBuffer qualifier, long ts, ByteBuffer value)
      Add the specified column and value, with the specified timestamp as its version to this Put operation.
      Parameters:
      family - family name
      qualifier - column qualifier
      ts - version timestamp
      value - column value
    • addImmutable

      @Deprecated public Put addImmutable(byte[] family, ByteBuffer qualifier, long ts, ByteBuffer value)
      Deprecated.
      As of release 2.0.0, this will be removed in HBase 3.0.0. Use add(Cell) and CellBuilder instead
      See addColumn(byte[], ByteBuffer, long, ByteBuffer). This version expects that the underlying arrays won't change. It's intended for usage internal HBase to and for advanced client applications.
    • add

      public Put add(Cell cell) throws IOException
      Add the specified KeyValue to this Put operation. Operation assumes that the passed KeyValue is immutable and its backing array will not be modified for the duration of this Put.
      Overrides:
      add in class Mutation
      Parameters:
      cell - individual cell
      Throws:
      IOException - e
    • setTimestamp

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

      public Put 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 Put 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 Put(byte[], long, NavigableMap) instead
      Method for setting the put's familyMap
      Overrides:
      setFamilyCellMap in class Mutation
    • setClusterIds

      public Put 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

      public Put setCellVisibility(CellVisibility expression)
      Description copied from class: Mutation
      Sets the visibility expression associated with cells in this Mutation.
      Overrides:
      setCellVisibility in class Mutation
    • setACL

      public Put 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 Put 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 Put 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 Put setPriority(int priority)
      Overrides:
      setPriority in class OperationWithAttributes