org.apache.hadoop.hbase.client.Table.checkAndDelete()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(167)

本文整理了Java中org.apache.hadoop.hbase.client.Table.checkAndDelete()方法的一些代码示例,展示了Table.checkAndDelete()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Table.checkAndDelete()方法的具体详情如下:
包路径:org.apache.hadoop.hbase.client.Table
类名称:Table
方法名:checkAndDelete

Table.checkAndDelete介绍

[英]Atomically checks if a row/family/qualifier value matches the expected value. If it does, it adds the delete. If the passed value is null, the check is for the lack of column (ie: non-existence) The expected value argument of this call is on the left and the current value of the cell is on the right side of the comparison operator. Ie. eg. GREATER operator means expected value > existing add the delete.
[中]

代码示例

代码示例来源:origin: apache/hbase

  1. /**
  2. * Atomically checks if a row/family/qualifier value matches the expected
  3. * value. If it does, it adds the delete. If the passed value is null, the
  4. * check is for the lack of column (ie: non-existance)
  5. *
  6. * @param row to check
  7. * @param family column family to check
  8. * @param qualifier column qualifier to check
  9. * @param value the expected value
  10. * @param delete data to delete if check succeeds
  11. * @throws IOException e
  12. * @return true if the new delete was executed, false otherwise
  13. * @deprecated Since 2.0.0. Will be removed in 3.0.0. Use {@link #checkAndMutate(byte[], byte[])}
  14. */
  15. @Deprecated
  16. default boolean checkAndDelete(byte[] row, byte[] family, byte[] qualifier,
  17. byte[] value, Delete delete) throws IOException {
  18. return checkAndDelete(row, family, qualifier, CompareOperator.EQUAL, value, delete);
  19. }

代码示例来源:origin: apache/phoenix

  1. @Override
  2. public boolean checkAndDelete(byte[] row, byte[] family, byte[] qualifier, CompareOp compareOp,
  3. byte[] value, Delete delete) throws IOException {
  4. return delegate.checkAndDelete(row, family, qualifier, compareOp, value, delete);
  5. }

代码示例来源:origin: apache/phoenix

  1. @Override
  2. public boolean checkAndDelete(byte[] row, byte[] family, byte[] qualifier, CompareOperator op,
  3. byte[] value, Delete delete) throws IOException {
  4. return delegate.checkAndDelete(row, family, qualifier, op, value, delete);
  5. }

代码示例来源:origin: apache/phoenix

  1. @Override
  2. public boolean checkAndDelete(byte[] row, byte[] family, byte[] qualifier, byte[] value,
  3. Delete delete) throws IOException {
  4. return delegate.checkAndDelete(row, family, qualifier, value, delete);
  5. }

代码示例来源:origin: apache/hbase

  1. assertObserverHasExecuted();
  2. assertTrue(table.checkAndDelete(ROW, FAMILY, QUALIFIER, VALUE, delete));
  3. assertObserverHasExecuted();

代码示例来源:origin: org.apache.hbase/hbase-client

  1. /**
  2. * Atomically checks if a row/family/qualifier value matches the expected
  3. * value. If it does, it adds the delete. If the passed value is null, the
  4. * check is for the lack of column (ie: non-existance)
  5. *
  6. * @param row to check
  7. * @param family column family to check
  8. * @param qualifier column qualifier to check
  9. * @param value the expected value
  10. * @param delete data to delete if check succeeds
  11. * @throws IOException e
  12. * @return true if the new delete was executed, false otherwise
  13. * @deprecated Since 2.0.0. Will be removed in 3.0.0. Use {@link #checkAndMutate(byte[], byte[])}
  14. */
  15. @Deprecated
  16. default boolean checkAndDelete(byte[] row, byte[] family, byte[] qualifier,
  17. byte[] value, Delete delete) throws IOException {
  18. return checkAndDelete(row, family, qualifier, CompareOperator.EQUAL, value, delete);
  19. }

代码示例来源:origin: larsgeorge/hbase-book

  1. delete1.addColumns(Bytes.toBytes("colfam1"), Bytes.toBytes("qual3")); // co CheckAndDeleteExample-1-Delete1 Create a new Delete instance.
  2. boolean res1 = table.checkAndDelete(Bytes.toBytes("row1"),
  3. Bytes.toBytes("colfam2"), Bytes.toBytes("qual3"), null, delete1); // co CheckAndDeleteExample-2-CAS1 Check if column does not exist and perform optional delete operation.
  4. System.out.println("Delete 1 successful: " + res1); // co CheckAndDeleteExample-3-SOUT1 Print out the result, should be "Delete successful: false".
  5. table.delete(delete2);
  6. boolean res2 = table.checkAndDelete(Bytes.toBytes("row1"),
  7. Bytes.toBytes("colfam2"), Bytes.toBytes("qual3"), null, delete1); // co CheckAndDeleteExample-5-CAS2 Attempt to delete same cell again.
  8. System.out.println("Delete 2 successful: " + res2); // co CheckAndDeleteExample-6-SOUT2 Print out the result, should be "Delete successful: true" since the checked column now is gone.
  9. boolean res4 = table.checkAndDelete(Bytes.toBytes("row1"),
  10. Bytes.toBytes("colfam1"), Bytes.toBytes("qual1"), // co CheckAndDeleteExample-8-CAS4 Try to delete while checking a different row.
  11. Bytes.toBytes("val1"), delete3);

代码示例来源:origin: larsgeorge/hbase-book

  1. delete = new Delete(Bytes.toBytes("row10"));
  2. delete.addColumn(Bytes.toBytes("colfam1"), Bytes.toBytes("qual17"));
  3. cap = table.checkAndDelete(Bytes.toBytes("row10"),
  4. Bytes.toBytes("colfam1"), Bytes.toBytes("qual15"), null, delete);
  5. System.out.println(" -> success: " + cap);
  6. cap = table.checkAndDelete(Bytes.toBytes("row10"),
  7. Bytes.toBytes("colfam1"), Bytes.toBytes("qual18"), null, delete);
  8. System.out.println(" -> success: " + cap);

代码示例来源:origin: org.apache.phoenix/phoenix-core

  1. @Override
  2. public boolean checkAndDelete(byte[] row, byte[] family, byte[] qualifier, CompareOperator op,
  3. byte[] value, Delete delete) throws IOException {
  4. return delegate.checkAndDelete(row, family, qualifier, op, value, delete);
  5. }

代码示例来源:origin: org.apache.phoenix/phoenix-core

  1. @Override
  2. public boolean checkAndDelete(byte[] row, byte[] family, byte[] qualifier, CompareOp compareOp,
  3. byte[] value, Delete delete) throws IOException {
  4. return delegate.checkAndDelete(row, family, qualifier, compareOp, value, delete);
  5. }

代码示例来源:origin: com.aliyun.phoenix/ali-phoenix-core

  1. @Override
  2. public boolean checkAndDelete(byte[] row, byte[] family, byte[] qualifier, CompareOperator op,
  3. byte[] value, Delete delete) throws IOException {
  4. return delegate.checkAndDelete(row, family, qualifier, op, value, delete);
  5. }

代码示例来源:origin: org.apache.phoenix/phoenix-core

  1. @Override
  2. public boolean checkAndDelete(byte[] row, byte[] family, byte[] qualifier, byte[] value,
  3. Delete delete) throws IOException {
  4. return delegate.checkAndDelete(row, family, qualifier, value, delete);
  5. }

代码示例来源:origin: com.aliyun.phoenix/ali-phoenix-core

  1. @Override
  2. public boolean checkAndDelete(byte[] row, byte[] family, byte[] qualifier, byte[] value,
  3. Delete delete) throws IOException {
  4. return delegate.checkAndDelete(row, family, qualifier, value, delete);
  5. }

代码示例来源:origin: com.aliyun.phoenix/ali-phoenix-core

  1. @Override
  2. public boolean checkAndDelete(byte[] row, byte[] family, byte[] qualifier, CompareOp compareOp,
  3. byte[] value, Delete delete) throws IOException {
  4. return delegate.checkAndDelete(row, family, qualifier, compareOp, value, delete);
  5. }

代码示例来源:origin: org.apache.tephra/tephra-hbase-compat-1.1

  1. @Override
  2. public boolean checkAndDelete(byte[] row, byte[] family, byte[] qualifier, byte[] value, Delete delete)
  3. throws IOException {
  4. if (allowNonTransactional) {
  5. return hTable.checkAndDelete(row, family, qualifier, value, delete);
  6. } else {
  7. throw new UnsupportedOperationException("Operation is not supported transactionally");
  8. }
  9. }

代码示例来源:origin: org.apache.tephra/tephra-hbase-compat-1.1

  1. @Override
  2. public boolean checkAndDelete(byte[] bytes, byte[] bytes1, byte[] bytes2, CompareFilter.CompareOp compareOp,
  3. byte[] bytes3, Delete delete) throws IOException {
  4. if (allowNonTransactional) {
  5. return hTable.checkAndDelete(bytes, bytes1, bytes2, compareOp, bytes3, delete);
  6. } else {
  7. throw new UnsupportedOperationException("Operation is not supported transactionally");
  8. }
  9. }

代码示例来源:origin: GoogleCloudPlatform/cloud-bigtable-client

  1. @Override
  2. protected boolean checkAndDelete(byte[] row, byte[] family, byte[] qualifier, byte[] value,
  3. Delete delete) throws IOException {
  4. return getDefaultTable().checkAndDelete(row, family, qualifier, value, delete);
  5. }

代码示例来源:origin: org.apache.hbase/hbase-server

  1. assertObserverHasExecuted();
  2. assertTrue(table.checkAndDelete(ROW, FAMILY, QUALIFIER, VALUE, delete));
  3. assertObserverHasExecuted();

相关文章