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

查看:630
本文介绍了Hbase checkAndPut和checkAndMutate有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Hbase 1.2.4中 checkAndPut和checkAndMutate有什么区别?

In Hbase 1.2.4 What is the difference between checkAndPut and checkAndMutate?

推荐答案

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

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-根据传递的CompareOp将值与hbase中的当前值进行比较.CompareOp= EQUALS如果期望值相等,则将该值添加到rowmutation对象.

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.

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

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

在rowmutation中,放置和删除内容的顺序

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

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

checkAndPut

查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆