本文整理了Java中org.apache.hadoop.hbase.client.Append.getRow()
方法的一些代码示例,展示了Append.getRow()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Append.getRow()
方法的具体详情如下:
包路径:org.apache.hadoop.hbase.client.Append
类名称:Append
方法名:getRow
暂无
代码示例来源:origin: apache/hbase
private static Cell createCustomCell(Append append) {
return createCustomCell(append.getRow(), FAMILY, QUALIFIER_FROM_CP, Cell.Type.Put,
APPEND_VALUE);
}
代码示例来源:origin: apache/hbase
@Override
public Result append(final Append append) throws IOException {
checkHasFamilies(append);
NoncedRegionServerCallable<Result> callable =
new NoncedRegionServerCallable<Result>(this.connection, getName(), append.getRow(),
this.rpcControllerFactory.newController(), append.getPriority()) {
@Override
protected Result rpcCall() throws Exception {
MutateRequest request = RequestConverter.buildMutateRequest(
getLocation().getRegionInfo().getRegionName(), append, getNonceGroup(), getNonce());
MutateResponse response = doMutate(request);
if (!response.hasResult()) return null;
return ProtobufUtil.toResult(response.getResult(), getRpcControllerCellScanner());
}
};
return rpcCallerFactory.<Result> newCaller(this.writeRpcTimeoutMs).
callWithRetries(callable, this.operationTimeoutMs);
}
代码示例来源:origin: apache/hbase
public static TAppend appendFromHBase(Append in) throws IOException {
TAppend out = new TAppend();
out.setRow(in.getRow());
代码示例来源:origin: apache/hbase
@Test
public void testAppendCopyConstructor() throws IOException {
Append origin = new Append(Bytes.toBytes("ROW-01"));
origin.setPriority(100);
byte[] family = Bytes.toBytes("CF-01");
origin.add(CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY)
.setRow(origin.getRow())
.setFamily(family)
.setQualifier(Bytes.toBytes("q"))
.setType(Type.Put)
.setValue(Bytes.toBytes(100))
.build());
origin.addColumn(family, Bytes.toBytes("q0"), Bytes.toBytes("value"));
origin.setTimeRange(100, 1000);
Append clone = new Append(origin);
assertEquals(origin, clone);
origin.addColumn(family, Bytes.toBytes("q1"), Bytes.toBytes("value"));
//They should have different cell lists
assertNotEquals(origin.getCellList(family), clone.getCellList(family));
}
代码示例来源:origin: apache/hbase
@Override
public Result preAppendAfterRowLock(final ObserverContext<RegionCoprocessorEnvironment> c,
final Append append) throws IOException {
if (append.getAttribute(CHECK_COVERING_PERM) != null) {
// We had failure with table, cf and q perm checks and now giving a chance for cell
// perm check
TableName table = c.getEnvironment().getRegion().getRegionInfo().getTable();
AuthResult authResult = null;
User user = getActiveUser(c);
if (checkCoveringPermission(user, OpType.APPEND, c.getEnvironment(), append.getRow(),
append.getFamilyCellMap(), append.getTimeRange().getMax(), Action.WRITE)) {
authResult = AuthResult.allow(OpType.APPEND.toString(),
"Covering cell set", user, Action.WRITE, table, append.getFamilyCellMap());
} else {
authResult = AuthResult.deny(OpType.APPEND.toString(),
"Covering cell set", user, Action.WRITE, table, append.getFamilyCellMap());
}
AccessChecker.logResult(authResult);
if (authorizationEnabled && !authResult.isAllowed()) {
throw new AccessDeniedException("Insufficient permissions " +
authResult.toContextString());
}
}
return null;
}
代码示例来源:origin: org.apache.hbase/hbase-client
@Override
public Result append(final Append append) throws IOException {
checkHasFamilies(append);
NoncedRegionServerCallable<Result> callable =
new NoncedRegionServerCallable<Result>(this.connection, getName(), append.getRow(),
this.rpcControllerFactory.newController(), append.getPriority()) {
@Override
protected Result rpcCall() throws Exception {
MutateRequest request = RequestConverter.buildMutateRequest(
getLocation().getRegionInfo().getRegionName(), append, getNonceGroup(), getNonce());
MutateResponse response = doMutate(request);
if (!response.hasResult()) return null;
return ProtobufUtil.toResult(response.getResult(), getRpcControllerCellScanner());
}
};
return rpcCallerFactory.<Result> newCaller(this.writeRpcTimeoutMs).
callWithRetries(callable, this.operationTimeoutMs);
}
代码示例来源:origin: org.apache.hbase/hbase-client
@Test
public void testAppendCopyConstructor() throws IOException {
Append origin = new Append(Bytes.toBytes("ROW-01"));
origin.setPriority(100);
byte[] family = Bytes.toBytes("CF-01");
origin.add(CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY)
.setRow(origin.getRow())
.setFamily(family)
.setQualifier(Bytes.toBytes("q"))
.setType(Type.Put)
.setValue(Bytes.toBytes(100))
.build());
origin.addColumn(family, Bytes.toBytes("q0"), Bytes.toBytes("value"));
origin.setTimeRange(100, 1000);
Append clone = new Append(origin);
assertEquals(origin, clone);
origin.addColumn(family, Bytes.toBytes("q1"), Bytes.toBytes("value"));
//They should have different cell lists
assertNotEquals(origin.getCellList(family), clone.getCellList(family));
}
代码示例来源:origin: forcedotcom/phoenix
e.complete();
HRegion region = env.getRegion();
byte[] row = append.getRow();
region.startRegionOperation();
try {
代码示例来源:origin: apache/phoenix
byte[] row = append.getRow();
List<RowLock> locks = Lists.newArrayList();
region.startRegionOperation();
代码示例来源:origin: urbanairship/statshtable
@Override
public Result append(final Append append) throws IOException {
try {
return timedExecute(OpType.APPEND, append.getRow(), new Callable<Result>() {
@Override
public Result call() throws IOException {
return normalHTable.append(append);
}
});
} catch (IOException e) {
throw e;
} catch (Exception e) {
final String errMsg = "Unexpected exception in stats wrapper for append";
log.error(errMsg, e);
throw new RuntimeException(errMsg, e);
}
}
代码示例来源:origin: co.cask.hbase/hbase
/**
* {@inheritDoc}
*/
@Override
public Result append(final Append append) throws IOException {
if (append.numFamilies() == 0) {
throw new IOException(
"Invalid arguments to append, no columns specified");
}
return new ServerCallable<Result>(connection, tableName, append.getRow(), operationTimeout) {
public Result call() throws IOException {
return server.append(
location.getRegionInfo().getRegionName(), append);
}
}.withRetries();
}
代码示例来源:origin: harbby/presto-connectors
/**
* Copy constructor
* @param a
*/
public Append(Append a) {
this.row = a.getRow();
this.ts = a.getTimeStamp();
this.familyMap.putAll(a.getFamilyCellMap());
for (Map.Entry<String, byte[]> entry : a.getAttributesMap().entrySet()) {
this.setAttribute(entry.getKey(), entry.getValue());
}
}
代码示例来源:origin: org.apache.hbase/hbase-server
private static Cell createCustomCell(Append append) {
return createCustomCell(append.getRow(), FAMILY, QUALIFIER_FROM_CP, Cell.Type.Put,
APPEND_VALUE);
}
代码示例来源:origin: com.google.cloud.bigtable/bigtable-hbase
/**
* <p>adapt.</p>
*
* @param append a {@link org.apache.hadoop.hbase.client.Append} object.
* @return a {@link com.google.bigtable.v2.ReadModifyWriteRowRequest} object.
*/
public ReadModifyWriteRowRequest adapt(Append append) {
ReadModifyWriteRow readModifyWriteRow = ReadModifyWriteRow
.create(bigtableTableName.getTableId(), ByteString.copyFrom(append.getRow()));
Adapters.APPEND_ADAPTER.adapt(append, readModifyWriteRow);
return readModifyWriteRow.toProto(requestContext);
}
代码示例来源:origin: GoogleCloudPlatform/cloud-bigtable-client
/**
* <p>adapt.</p>
*
* @param append a {@link org.apache.hadoop.hbase.client.Append} object.
* @return a {@link com.google.bigtable.v2.ReadModifyWriteRowRequest} object.
*/
public ReadModifyWriteRowRequest adapt(Append append) {
ReadModifyWriteRow readModifyWriteRow = ReadModifyWriteRow
.create(bigtableTableName.getTableId(), ByteString.copyFrom(append.getRow()));
Adapters.APPEND_ADAPTER.adapt(append, readModifyWriteRow);
return readModifyWriteRow.toProto(requestContext);
}
代码示例来源:origin: com.aliyun.hbase/alihbase-client
@Override
public Result append(final Append append) throws IOException {
checkHasFamilies(append);
NoncedRegionServerCallable<Result> callable =
new NoncedRegionServerCallable<Result>(this.connection, getName(), append.getRow(),
this.rpcControllerFactory.newController(), append.getPriority()) {
@Override
protected Result rpcCall() throws Exception {
MutateRequest request = RequestConverter.buildMutateRequest(
getLocation().getRegionInfo().getRegionName(), append, getNonceGroup(), getNonce());
MutateResponse response = doMutate(request);
if (!response.hasResult()) return null;
return ProtobufUtil.toResult(response.getResult(), getRpcControllerCellScanner());
}
};
return rpcCallerFactory.<Result> newCaller(this.writeRpcTimeoutMs).
callWithRetries(callable, this.operationTimeoutMs);
}
代码示例来源:origin: harbby/presto-connectors
final long nonceGroup = ng.getNonceGroup(), nonce = ng.newNonce();
RegionServerCallable<Result> callable =
new RegionServerCallable<Result>(this.connection, getName(), append.getRow()) {
@Override
public Result call(int callTimeout) throws IOException {
代码示例来源:origin: GoogleCloudPlatform/cloud-bigtable-client
/** {@inheritDoc} */
@Override
public Result append(Append append) throws IOException {
LOG.trace("append(Append)");
Span span = TRACER.spanBuilder("BigtableTable.append").startSpan();
try (Scope scope = TRACER.withSpan(span)) {
ReadModifyWriteRowRequest request = hbaseAdapter.adapt(append);
ReadModifyWriteRowResponse response = client.readModifyWriteRow(request);
// The bigtable API will always return the mutated results. In order to maintain
// compatibility, simply return null when results were not requested.
if (append.isReturnResults()) {
return Adapters.ROW_ADAPTER.adaptResponse(response.getRow());
} else {
return null;
}
} catch (Throwable t) {
span.setStatus(Status.UNKNOWN);
throw logAndCreateIOException("append", append.getRow(), t);
} finally {
span.end();
}
}
代码示例来源:origin: com.google.cloud.bigtable/bigtable-hbase
/** {@inheritDoc} */
@Override
public Result append(Append append) throws IOException {
LOG.trace("append(Append)");
Span span = TRACER.spanBuilder("BigtableTable.append").startSpan();
try (Scope scope = TRACER.withSpan(span)) {
ReadModifyWriteRowRequest request = hbaseAdapter.adapt(append);
ReadModifyWriteRowResponse response = client.readModifyWriteRow(request);
// The bigtable API will always return the mutated results. In order to maintain
// compatibility, simply return null when results were not requested.
if (append.isReturnResults()) {
return Adapters.ROW_ADAPTER.adaptResponse(response.getRow());
} else {
return null;
}
} catch (Throwable t) {
span.setStatus(Status.UNKNOWN);
throw logAndCreateIOException("append", append.getRow(), t);
} finally {
span.end();
}
}
代码示例来源:origin: harbby/presto-connectors
@Override
public Result preAppendAfterRowLock(final ObserverContext<RegionCoprocessorEnvironment> c,
final Append append) throws IOException {
if (append.getAttribute(CHECK_COVERING_PERM) != null) {
// We had failure with table, cf and q perm checks and now giving a chance for cell
// perm check
TableName table = c.getEnvironment().getRegion().getRegionInfo().getTable();
AuthResult authResult = null;
if (checkCoveringPermission(OpType.APPEND, c.getEnvironment(), append.getRow(),
append.getFamilyCellMap(), HConstants.LATEST_TIMESTAMP, Action.WRITE)) {
authResult = AuthResult.allow(OpType.APPEND.toString(), "Covering cell set",
getActiveUser(), Action.WRITE, table, append.getFamilyCellMap());
} else {
authResult = AuthResult.deny(OpType.APPEND.toString(), "Covering cell set",
getActiveUser(), Action.WRITE, table, append.getFamilyCellMap());
}
logResult(authResult);
if (authorizationEnabled && !authResult.isAllowed()) {
throw new AccessDeniedException("Insufficient permissions " +
authResult.toContextString());
}
}
return null;
}
内容来源于网络,如有侵权,请联系作者删除!