2016-11-22 86 views

回答

1

checkAndPut - 根據傳遞的CompareOp將該值與來自hbase的當前值進行比較。 CompareOp = EQUALS如果期望值相等,則將值添加到put對象。

checkAndMutate - 根據傳入的比較值與來自hbase的當前值CompareOp.CompareOp = EQUALS如果期望值相等,則將值添加到rowmutation對象。

,你可以在你想要的突變執行HBase的到rowmutation對象

在rowmutation看跌期權的順序和物質刪除

RowMutations mutations = new RowMutations(row); 
//add new columns 
Put put = new Put(row); 
put.add(cf, col1, v1); 
put.add(cf, col2, v2); 

Delete delete = new Delete(row); 
delete.deleteFamily(cf1, now); 

//delete column family and add new columns to same family 
mutations.add(delete); 
mutations.add(put); 

table.mutateRow(mutations); 

checkAndMutate的順序添加多個PUT和DELETE對象 https://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/Table.html#checkAndMutate-byte:A-byte:A-byte:A-org.apache.hadoop.hbase.filter.CompareFilter.CompareOp-byte:A-org.apache.hadoop.hbase.client.RowMutations-

checkAndPut

https://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/Table.html#checkAndPut-byte:A-byte:A-byte:A-org.apache.hadoop.hbase.filter.CompareFilter.CompareOp-byte:A-org.apache.hadoop.hbase.client.Put-