Skip to content

Commit

Permalink
fix(kv): fix checkAndDelete (#354)
Browse files Browse the repository at this point in the history
  • Loading branch information
caojiajun committed Nov 21, 2024
1 parent 8b822d2 commit 830a380
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,12 @@ public boolean supportCheckAndDelete() {
@Override
public void checkAndDelete(int slot, byte[] key, byte[] value) {
try {
TableQuery tableQuery = obTableClient.query(tableName).select("slot", "k", "v");
ObTableValueFilter filter1 = new ObTableValueFilter(ObCompareOp.EQ, "slot", slot);
ObTableValueFilter filter2 = new ObTableValueFilter(ObCompareOp.EQ, "k", key);
ObTableValueFilter filter3 = new ObTableValueFilter(ObCompareOp.EQ, "v", value);
ObTableFilterList filterList = new ObTableFilterList(ObTableFilterList.operator.AND, filter1, filter2, filter3);
tableQuery.setFilter(filterList);
TableQuery tableQuery = obTableClient.query(tableName)
.select("slot", "k", "v")
.addScanRange(new Object[]{slot, key}, true, new Object[]{slot, key}, true)
.limit(1);
ObTableValueFilter filter = new ObTableValueFilter(ObCompareOp.EQ, "v", value);
tableQuery.setFilter(filter);
ObTableQueryAndMutateRequest request = obTableClient.obTableQueryAndDelete(tableQuery);
obTableClient.execute(request);
} catch (Exception e) {
Expand Down

0 comments on commit 830a380

Please sign in to comment.