org.apache.hadoop.hbase.client
Class Put

java.lang.Object
  extended by org.apache.hadoop.hbase.client.Operation
      extended by org.apache.hadoop.hbase.client.OperationWithAttributes
          extended by org.apache.hadoop.hbase.client.Mutation
              extended by org.apache.hadoop.hbase.client.Put
All Implemented Interfaces:
Comparable<Row>, CellScannable, Attributes, Row, HeapSize

@InterfaceAudience.Public
@InterfaceStability.Stable
public class Put
extends Mutation
implements HeapSize, Comparable<Row>

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.


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
 
Constructor Summary
Put(byte[] row)
          Create a Put operation for the specified row.
Put(byte[] rowArray, int rowOffset, int rowLength, long ts)
          We make a copy of the passed in row key to keep local.
Put(byte[] row, long ts)
          Create a Put operation for the specified row, using a given timestamp.
Put(Put putToCopy)
          Copy constructor.
 
Method Summary
 Put add(byte[] family, byte[] qualifier, byte[] value)
          Add the specified column and value to this Put operation.
 Put add(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.
 Put add(KeyValue kv)
          Add the specified KeyValue to this Put operation.
 List<KeyValue> get(byte[] family, byte[] qualifier)
          Returns a list of all KeyValue objects with matching column family and qualifier.
 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.
 
Methods inherited from class org.apache.hadoop.hbase.client.Mutation
cellScanner, compareTo, extraHeapSize, getClusterId, getDurability, getFamilyMap, getFingerprint, getRow, getTimeStamp, heapSize, isEmpty, numFamilies, setClusterId, setDurability, setFamilyMap, size, toMap
 
Methods inherited from class org.apache.hadoop.hbase.client.OperationWithAttributes
getAttribute, getAttributeSize, getAttributesMap, getId, setAttribute, setId
 
Methods inherited from class org.apache.hadoop.hbase.client.Operation
toJSON, toJSON, toMap, toString, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.hadoop.hbase.io.HeapSize
heapSize
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Constructor Detail

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,
           long ts)
We make a copy of the passed in row key to keep local.

Parameters:
rowArray -
rowOffset -
rowLength -
ts -

Put

public Put(Put putToCopy)
Copy constructor. Creates a Put operation cloned from the specified Put.

Parameters:
putToCopy - put to copy
Method Detail

add

public Put add(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
Returns:
this

add

public Put add(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
Returns:
this

add

public Put add(KeyValue kv)
        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.

Parameters:
kv - individual KeyValue
Returns:
this
Throws:
IOException - e

has

public 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. Both given arguments must match the KeyValue object to return true.

Parameters:
family - column family
qualifier - column qualifier
Returns:
returns true if the given family and qualifier already has an existing KeyValue object in the family map.

has

public 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. All 3 given arguments must match the KeyValue object to return true.

Parameters:
family - column family
qualifier - column qualifier
ts - timestamp
Returns:
returns true if the given family, qualifier and timestamp already has an existing KeyValue object in the family map.

has

public 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. All 3 given arguments must match the KeyValue object to return true.

Parameters:
family - column family
qualifier - column qualifier
value - value to check
Returns:
returns true if the given family, qualifier and value already has an existing KeyValue object in the family map.

has

public 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. All 4 given arguments must match the KeyValue object to return true.

Parameters:
family - column family
qualifier - column qualifier
ts - timestamp
value - 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

public List<KeyValue> get(byte[] family,
                          byte[] qualifier)
Returns a list of all KeyValue objects with matching column family and qualifier.

Parameters:
family - column family
qualifier - column qualifier
Returns:
a list of KeyValue objects with the matching family and qualifier, returns an empty list if one doesnt exist for the given family.


Copyright © 2013 The Apache Software Foundation. All Rights Reserved.