Hbase checkAndPut和checkAndMutate有什么区别?(What is the difference between Hbase checkAndPut and checkAndMutate?


 

 

checkAndPut - compares the value with the current value from the hbase according to the passed CompareOp. CompareOp=EQUALS Adds the value to the put object if expected value is equal.

checkAndMutate - compares the value with the current value from the hbase according to the passed CompareOp.CompareOp=EQUALS Adds the value to the rowmutation object if expected value is equal.

you can add multiple put and delete objects in the order in which you wants the mutation to executes in hbase to the rowmutation object

In rowmutation the order of puts and deletes matter

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

 

checkAndPut-比较根据传递的CompareOp将值与hbase中的当前值进行比较。 CompareOp = EQUALS如果期望值相等,则将值添加到放置对象中。



checkAndMutate-根据传递的CompareOp将值与hbase中的当前值进行比较。CompareOp= EQUALS如果期望值相等,则将值添加到rowmutation对象。 / p> 

您可以按照希望突变在hbase中执行的顺序向rowmutation对象添加和删除多个对象



在行变异中,放置和删除内容的顺序



  RowMutations变异=新的RowMutations(row); 
//添加新列
Put put = new Put(row);
put.add(cf,col1,v1);
put.add(cf,col2,v2);

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

//删除列族并将新列添加到同一族
突变。add(delete);
mutation.add(put);

table.mutateRow(mutations);



checkAndMutate 
https://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/Table.html#checkAndMutate-byte:A字节: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-

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM