Search in sources :

Example 6 with TMutation

use of org.apache.hadoop.hbase.thrift2.generated.TMutation in project hbase by apache.

the class ThriftUtilities method rowMutationsFromThrift.

/**
 * Creates a {@link RowMutations} (HBase) from a {@link TRowMutations} (Thrift)
 *
 * @param in the <code>TRowMutations</code> to convert
 *
 * @return converted <code>RowMutations</code>
 */
public static RowMutations rowMutationsFromThrift(TRowMutations in) throws IOException {
    List<TMutation> mutations = in.getMutations();
    RowMutations out = new RowMutations(in.getRow(), mutations.size());
    for (TMutation mutation : mutations) {
        if (mutation.isSetPut()) {
            out.add(putFromThrift(mutation.getPut()));
        }
        if (mutation.isSetDeleteSingle()) {
            out.add(deleteFromThrift(mutation.getDeleteSingle()));
        }
    }
    return out;
}
Also used : TMutation(org.apache.hadoop.hbase.thrift2.generated.TMutation) TRowMutations(org.apache.hadoop.hbase.thrift2.generated.TRowMutations) RowMutations(org.apache.hadoop.hbase.client.RowMutations)

Aggregations

TRowMutations (org.apache.hadoop.hbase.thrift2.generated.TRowMutations)6 TPut (org.apache.hadoop.hbase.thrift2.generated.TPut)5 ByteBuffer (java.nio.ByteBuffer)4 ArrayList (java.util.ArrayList)4 TColumnValue (org.apache.hadoop.hbase.thrift2.generated.TColumnValue)4 TMutation (org.apache.hadoop.hbase.thrift2.generated.TMutation)4 Test (org.junit.Test)4 TDelete (org.apache.hadoop.hbase.thrift2.generated.TDelete)3 DoNotRetryIOException (org.apache.hadoop.hbase.DoNotRetryIOException)2 TGet (org.apache.hadoop.hbase.thrift2.generated.TGet)2 TIOError (org.apache.hadoop.hbase.thrift2.generated.TIOError)2 TResult (org.apache.hadoop.hbase.thrift2.generated.TResult)2 Delete (org.apache.hadoop.hbase.client.Delete)1 Mutation (org.apache.hadoop.hbase.client.Mutation)1 Put (org.apache.hadoop.hbase.client.Put)1 RowMutations (org.apache.hadoop.hbase.client.RowMutations)1 TColumn (org.apache.hadoop.hbase.thrift2.generated.TColumn)1