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

x33g5p2x  于2022-01-16 转载在 其他  
字(11.1k)|赞(0)|评价(0)|浏览(221)

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

Append.getRow介绍

暂无

代码示例

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

  1. private static Cell createCustomCell(Append append) {
  2. return createCustomCell(append.getRow(), FAMILY, QUALIFIER_FROM_CP, Cell.Type.Put,
  3. APPEND_VALUE);
  4. }

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

  1. @Override
  2. public Result append(final Append append) throws IOException {
  3. checkHasFamilies(append);
  4. NoncedRegionServerCallable<Result> callable =
  5. new NoncedRegionServerCallable<Result>(this.connection, getName(), append.getRow(),
  6. this.rpcControllerFactory.newController(), append.getPriority()) {
  7. @Override
  8. protected Result rpcCall() throws Exception {
  9. MutateRequest request = RequestConverter.buildMutateRequest(
  10. getLocation().getRegionInfo().getRegionName(), append, getNonceGroup(), getNonce());
  11. MutateResponse response = doMutate(request);
  12. if (!response.hasResult()) return null;
  13. return ProtobufUtil.toResult(response.getResult(), getRpcControllerCellScanner());
  14. }
  15. };
  16. return rpcCallerFactory.<Result> newCaller(this.writeRpcTimeoutMs).
  17. callWithRetries(callable, this.operationTimeoutMs);
  18. }

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

  1. public static TAppend appendFromHBase(Append in) throws IOException {
  2. TAppend out = new TAppend();
  3. out.setRow(in.getRow());

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

  1. @Test
  2. public void testAppendCopyConstructor() throws IOException {
  3. Append origin = new Append(Bytes.toBytes("ROW-01"));
  4. origin.setPriority(100);
  5. byte[] family = Bytes.toBytes("CF-01");
  6. origin.add(CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY)
  7. .setRow(origin.getRow())
  8. .setFamily(family)
  9. .setQualifier(Bytes.toBytes("q"))
  10. .setType(Type.Put)
  11. .setValue(Bytes.toBytes(100))
  12. .build());
  13. origin.addColumn(family, Bytes.toBytes("q0"), Bytes.toBytes("value"));
  14. origin.setTimeRange(100, 1000);
  15. Append clone = new Append(origin);
  16. assertEquals(origin, clone);
  17. origin.addColumn(family, Bytes.toBytes("q1"), Bytes.toBytes("value"));
  18. //They should have different cell lists
  19. assertNotEquals(origin.getCellList(family), clone.getCellList(family));
  20. }

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

  1. @Override
  2. public Result preAppendAfterRowLock(final ObserverContext<RegionCoprocessorEnvironment> c,
  3. final Append append) throws IOException {
  4. if (append.getAttribute(CHECK_COVERING_PERM) != null) {
  5. // We had failure with table, cf and q perm checks and now giving a chance for cell
  6. // perm check
  7. TableName table = c.getEnvironment().getRegion().getRegionInfo().getTable();
  8. AuthResult authResult = null;
  9. User user = getActiveUser(c);
  10. if (checkCoveringPermission(user, OpType.APPEND, c.getEnvironment(), append.getRow(),
  11. append.getFamilyCellMap(), append.getTimeRange().getMax(), Action.WRITE)) {
  12. authResult = AuthResult.allow(OpType.APPEND.toString(),
  13. "Covering cell set", user, Action.WRITE, table, append.getFamilyCellMap());
  14. } else {
  15. authResult = AuthResult.deny(OpType.APPEND.toString(),
  16. "Covering cell set", user, Action.WRITE, table, append.getFamilyCellMap());
  17. }
  18. AccessChecker.logResult(authResult);
  19. if (authorizationEnabled && !authResult.isAllowed()) {
  20. throw new AccessDeniedException("Insufficient permissions " +
  21. authResult.toContextString());
  22. }
  23. }
  24. return null;
  25. }

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

  1. @Override
  2. public Result append(final Append append) throws IOException {
  3. checkHasFamilies(append);
  4. NoncedRegionServerCallable<Result> callable =
  5. new NoncedRegionServerCallable<Result>(this.connection, getName(), append.getRow(),
  6. this.rpcControllerFactory.newController(), append.getPriority()) {
  7. @Override
  8. protected Result rpcCall() throws Exception {
  9. MutateRequest request = RequestConverter.buildMutateRequest(
  10. getLocation().getRegionInfo().getRegionName(), append, getNonceGroup(), getNonce());
  11. MutateResponse response = doMutate(request);
  12. if (!response.hasResult()) return null;
  13. return ProtobufUtil.toResult(response.getResult(), getRpcControllerCellScanner());
  14. }
  15. };
  16. return rpcCallerFactory.<Result> newCaller(this.writeRpcTimeoutMs).
  17. callWithRetries(callable, this.operationTimeoutMs);
  18. }

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

  1. @Test
  2. public void testAppendCopyConstructor() throws IOException {
  3. Append origin = new Append(Bytes.toBytes("ROW-01"));
  4. origin.setPriority(100);
  5. byte[] family = Bytes.toBytes("CF-01");
  6. origin.add(CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY)
  7. .setRow(origin.getRow())
  8. .setFamily(family)
  9. .setQualifier(Bytes.toBytes("q"))
  10. .setType(Type.Put)
  11. .setValue(Bytes.toBytes(100))
  12. .build());
  13. origin.addColumn(family, Bytes.toBytes("q0"), Bytes.toBytes("value"));
  14. origin.setTimeRange(100, 1000);
  15. Append clone = new Append(origin);
  16. assertEquals(origin, clone);
  17. origin.addColumn(family, Bytes.toBytes("q1"), Bytes.toBytes("value"));
  18. //They should have different cell lists
  19. assertNotEquals(origin.getCellList(family), clone.getCellList(family));
  20. }

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

  1. e.complete();
  2. HRegion region = env.getRegion();
  3. byte[] row = append.getRow();
  4. region.startRegionOperation();
  5. try {

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

  1. byte[] row = append.getRow();
  2. List<RowLock> locks = Lists.newArrayList();
  3. region.startRegionOperation();

代码示例来源:origin: urbanairship/statshtable

  1. @Override
  2. public Result append(final Append append) throws IOException {
  3. try {
  4. return timedExecute(OpType.APPEND, append.getRow(), new Callable<Result>() {
  5. @Override
  6. public Result call() throws IOException {
  7. return normalHTable.append(append);
  8. }
  9. });
  10. } catch (IOException e) {
  11. throw e;
  12. } catch (Exception e) {
  13. final String errMsg = "Unexpected exception in stats wrapper for append";
  14. log.error(errMsg, e);
  15. throw new RuntimeException(errMsg, e);
  16. }
  17. }

代码示例来源:origin: co.cask.hbase/hbase

  1. /**
  2. * {@inheritDoc}
  3. */
  4. @Override
  5. public Result append(final Append append) throws IOException {
  6. if (append.numFamilies() == 0) {
  7. throw new IOException(
  8. "Invalid arguments to append, no columns specified");
  9. }
  10. return new ServerCallable<Result>(connection, tableName, append.getRow(), operationTimeout) {
  11. public Result call() throws IOException {
  12. return server.append(
  13. location.getRegionInfo().getRegionName(), append);
  14. }
  15. }.withRetries();
  16. }

代码示例来源:origin: harbby/presto-connectors

  1. /**
  2. * Copy constructor
  3. * @param a
  4. */
  5. public Append(Append a) {
  6. this.row = a.getRow();
  7. this.ts = a.getTimeStamp();
  8. this.familyMap.putAll(a.getFamilyCellMap());
  9. for (Map.Entry<String, byte[]> entry : a.getAttributesMap().entrySet()) {
  10. this.setAttribute(entry.getKey(), entry.getValue());
  11. }
  12. }

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

  1. private static Cell createCustomCell(Append append) {
  2. return createCustomCell(append.getRow(), FAMILY, QUALIFIER_FROM_CP, Cell.Type.Put,
  3. APPEND_VALUE);
  4. }

代码示例来源:origin: com.google.cloud.bigtable/bigtable-hbase

  1. /**
  2. * <p>adapt.</p>
  3. *
  4. * @param append a {@link org.apache.hadoop.hbase.client.Append} object.
  5. * @return a {@link com.google.bigtable.v2.ReadModifyWriteRowRequest} object.
  6. */
  7. public ReadModifyWriteRowRequest adapt(Append append) {
  8. ReadModifyWriteRow readModifyWriteRow = ReadModifyWriteRow
  9. .create(bigtableTableName.getTableId(), ByteString.copyFrom(append.getRow()));
  10. Adapters.APPEND_ADAPTER.adapt(append, readModifyWriteRow);
  11. return readModifyWriteRow.toProto(requestContext);
  12. }

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

  1. /**
  2. * <p>adapt.</p>
  3. *
  4. * @param append a {@link org.apache.hadoop.hbase.client.Append} object.
  5. * @return a {@link com.google.bigtable.v2.ReadModifyWriteRowRequest} object.
  6. */
  7. public ReadModifyWriteRowRequest adapt(Append append) {
  8. ReadModifyWriteRow readModifyWriteRow = ReadModifyWriteRow
  9. .create(bigtableTableName.getTableId(), ByteString.copyFrom(append.getRow()));
  10. Adapters.APPEND_ADAPTER.adapt(append, readModifyWriteRow);
  11. return readModifyWriteRow.toProto(requestContext);
  12. }

代码示例来源:origin: com.aliyun.hbase/alihbase-client

  1. @Override
  2. public Result append(final Append append) throws IOException {
  3. checkHasFamilies(append);
  4. NoncedRegionServerCallable<Result> callable =
  5. new NoncedRegionServerCallable<Result>(this.connection, getName(), append.getRow(),
  6. this.rpcControllerFactory.newController(), append.getPriority()) {
  7. @Override
  8. protected Result rpcCall() throws Exception {
  9. MutateRequest request = RequestConverter.buildMutateRequest(
  10. getLocation().getRegionInfo().getRegionName(), append, getNonceGroup(), getNonce());
  11. MutateResponse response = doMutate(request);
  12. if (!response.hasResult()) return null;
  13. return ProtobufUtil.toResult(response.getResult(), getRpcControllerCellScanner());
  14. }
  15. };
  16. return rpcCallerFactory.<Result> newCaller(this.writeRpcTimeoutMs).
  17. callWithRetries(callable, this.operationTimeoutMs);
  18. }

代码示例来源:origin: harbby/presto-connectors

  1. final long nonceGroup = ng.getNonceGroup(), nonce = ng.newNonce();
  2. RegionServerCallable<Result> callable =
  3. new RegionServerCallable<Result>(this.connection, getName(), append.getRow()) {
  4. @Override
  5. public Result call(int callTimeout) throws IOException {

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

  1. /** {@inheritDoc} */
  2. @Override
  3. public Result append(Append append) throws IOException {
  4. LOG.trace("append(Append)");
  5. Span span = TRACER.spanBuilder("BigtableTable.append").startSpan();
  6. try (Scope scope = TRACER.withSpan(span)) {
  7. ReadModifyWriteRowRequest request = hbaseAdapter.adapt(append);
  8. ReadModifyWriteRowResponse response = client.readModifyWriteRow(request);
  9. // The bigtable API will always return the mutated results. In order to maintain
  10. // compatibility, simply return null when results were not requested.
  11. if (append.isReturnResults()) {
  12. return Adapters.ROW_ADAPTER.adaptResponse(response.getRow());
  13. } else {
  14. return null;
  15. }
  16. } catch (Throwable t) {
  17. span.setStatus(Status.UNKNOWN);
  18. throw logAndCreateIOException("append", append.getRow(), t);
  19. } finally {
  20. span.end();
  21. }
  22. }

代码示例来源:origin: com.google.cloud.bigtable/bigtable-hbase

  1. /** {@inheritDoc} */
  2. @Override
  3. public Result append(Append append) throws IOException {
  4. LOG.trace("append(Append)");
  5. Span span = TRACER.spanBuilder("BigtableTable.append").startSpan();
  6. try (Scope scope = TRACER.withSpan(span)) {
  7. ReadModifyWriteRowRequest request = hbaseAdapter.adapt(append);
  8. ReadModifyWriteRowResponse response = client.readModifyWriteRow(request);
  9. // The bigtable API will always return the mutated results. In order to maintain
  10. // compatibility, simply return null when results were not requested.
  11. if (append.isReturnResults()) {
  12. return Adapters.ROW_ADAPTER.adaptResponse(response.getRow());
  13. } else {
  14. return null;
  15. }
  16. } catch (Throwable t) {
  17. span.setStatus(Status.UNKNOWN);
  18. throw logAndCreateIOException("append", append.getRow(), t);
  19. } finally {
  20. span.end();
  21. }
  22. }

代码示例来源:origin: harbby/presto-connectors

  1. @Override
  2. public Result preAppendAfterRowLock(final ObserverContext<RegionCoprocessorEnvironment> c,
  3. final Append append) throws IOException {
  4. if (append.getAttribute(CHECK_COVERING_PERM) != null) {
  5. // We had failure with table, cf and q perm checks and now giving a chance for cell
  6. // perm check
  7. TableName table = c.getEnvironment().getRegion().getRegionInfo().getTable();
  8. AuthResult authResult = null;
  9. if (checkCoveringPermission(OpType.APPEND, c.getEnvironment(), append.getRow(),
  10. append.getFamilyCellMap(), HConstants.LATEST_TIMESTAMP, Action.WRITE)) {
  11. authResult = AuthResult.allow(OpType.APPEND.toString(), "Covering cell set",
  12. getActiveUser(), Action.WRITE, table, append.getFamilyCellMap());
  13. } else {
  14. authResult = AuthResult.deny(OpType.APPEND.toString(), "Covering cell set",
  15. getActiveUser(), Action.WRITE, table, append.getFamilyCellMap());
  16. }
  17. logResult(authResult);
  18. if (authorizationEnabled && !authResult.isAllowed()) {
  19. throw new AccessDeniedException("Insufficient permissions " +
  20. authResult.toContextString());
  21. }
  22. }
  23. return null;
  24. }

相关文章