本文整理了Java中org.apache.hadoop.hbase.client.Put.isEmpty()
方法的一些代码示例,展示了Put.isEmpty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Put.isEmpty()
方法的具体详情如下:
包路径:org.apache.hadoop.hbase.client.Put
类名称:Put
方法名:isEmpty
暂无
代码示例来源:origin: apache/hbase
public static void validatePut(Put put, int maxKeyValueSize) throws IllegalArgumentException {
if (put.isEmpty()) {
throw new IllegalArgumentException("No columns to insert");
}
if (maxKeyValueSize > 0) {
for (List<Cell> list : put.getFamilyCellMap().values()) {
for (Cell cell : list) {
if (cell.getSerializedSize() > maxKeyValueSize) {
throw new IllegalArgumentException("KeyValue size too large");
}
}
}
}
}
代码示例来源:origin: apache/hbase
/**
* Submit immediately the list of rows, whatever the server status. Kept for backward
* compatibility: it allows to be used with the batch interface that return an array of objects.
* @param task The setting and data
*/
private <CResult> AsyncRequestFuture submitAll(AsyncProcessTask task) {
RowAccess<? extends Row> rows = task.getRowAccess();
List<Action> actions = new ArrayList<>(rows.size());
// The position will be used by the processBatch to match the object array returned.
int posInList = -1;
NonceGenerator ng = this.connection.getNonceGenerator();
int highestPriority = HConstants.PRIORITY_UNSET;
for (Row r : rows) {
posInList++;
if (r instanceof Put) {
Put put = (Put) r;
if (put.isEmpty()) {
throw new IllegalArgumentException("No columns to insert for #" + (posInList+1)+ " item");
}
highestPriority = Math.max(put.getPriority(), highestPriority);
}
Action action = new Action(r, posInList, highestPriority);
setNonce(ng, r, action);
actions.add(action);
}
AsyncRequestFutureImpl<CResult> ars = createAsyncRequestFuture(task, actions, ng.getNonceGroup());
ars.groupAndSendMultiAction(actions, 1);
return ars;
}
代码示例来源:origin: apache/hbase
deletes.add(delete);
if (!put.isEmpty()) {
puts.add(put);
代码示例来源:origin: apache/hbase
if (!put.isEmpty()) {
mutator.mutate(put);
代码示例来源:origin: apache/hbase
table.delete(delete);
if (!put.isEmpty()) {
table.put(put);
代码示例来源:origin: org.apache.hbase/hbase-client
public static void validatePut(Put put, int maxKeyValueSize) throws IllegalArgumentException {
if (put.isEmpty()) {
throw new IllegalArgumentException("No columns to insert");
}
if (maxKeyValueSize > 0) {
for (List<Cell> list : put.getFamilyCellMap().values()) {
for (Cell cell : list) {
if (KeyValueUtil.length(cell) > maxKeyValueSize) {
throw new IllegalArgumentException("KeyValue size too large");
}
}
}
}
}
代码示例来源:origin: org.apache.hbase/hbase-client
/**
* Submit immediately the list of rows, whatever the server status. Kept for backward
* compatibility: it allows to be used with the batch interface that return an array of objects.
* @param task The setting and data
*/
private <CResult> AsyncRequestFuture submitAll(AsyncProcessTask task) {
RowAccess<? extends Row> rows = task.getRowAccess();
List<Action> actions = new ArrayList<>(rows.size());
// The position will be used by the processBatch to match the object array returned.
int posInList = -1;
NonceGenerator ng = this.connection.getNonceGenerator();
int highestPriority = HConstants.PRIORITY_UNSET;
for (Row r : rows) {
posInList++;
if (r instanceof Put) {
Put put = (Put) r;
if (put.isEmpty()) {
throw new IllegalArgumentException("No columns to insert for #" + (posInList+1)+ " item");
}
highestPriority = Math.max(put.getPriority(), highestPriority);
}
Action action = new Action(r, posInList, highestPriority);
setNonce(ng, r, action);
actions.add(action);
}
AsyncRequestFutureImpl<CResult> ars = createAsyncRequestFuture(task, actions, ng.getNonceGroup());
ars.groupAndSendMultiAction(actions, 1);
return ars;
}
代码示例来源:origin: cdapio/cdap
@Override
public boolean isEmpty() {
return put.isEmpty();
}
代码示例来源:origin: co.cask.cdap/cdap-hbase-compat-base
@Override
public boolean isEmpty() {
return put.isEmpty();
}
代码示例来源:origin: opencb/opencga
@Override
public List<Put> apply(List<Variant> list) throws IOException {
List<Put> puts = new ArrayList<>(list.size());
for (Variant variant : list) {
Put put = fillGaps(variant);
if (put != null && !put.isEmpty()) {
puts.add(put);
}
}
return puts;
}
代码示例来源:origin: com.aliyun.hbase/alihbase-client
public static void validatePut(Put put, int maxKeyValueSize) throws IllegalArgumentException {
if (put.isEmpty()) {
throw new IllegalArgumentException("No columns to insert");
}
if (maxKeyValueSize > 0) {
for (List<Cell> list : put.getFamilyCellMap().values()) {
for (Cell cell : list) {
if (KeyValueUtil.length(cell) > maxKeyValueSize) {
throw new IllegalArgumentException("KeyValue size too large");
}
}
}
}
}
代码示例来源:origin: co.cask.hbase/hbase
private void validatePut(final Put put) throws IllegalArgumentException{
if (put.isEmpty()) {
throw new IllegalArgumentException("No columns to insert");
}
if (maxKeyValueSize > 0) {
for (List<KeyValue> list : put.getFamilyMap().values()) {
for (KeyValue kv : list) {
if (kv.getLength() > maxKeyValueSize) {
throw new IllegalArgumentException("KeyValue size too large");
}
}
}
}
}
代码示例来源:origin: harbby/presto-connectors
public static void validatePut(Put put, int maxKeyValueSize) throws IllegalArgumentException {
if (put.isEmpty()) {
throw new IllegalArgumentException("No columns to insert");
}
if (maxKeyValueSize > 0) {
for (List<Cell> list : put.getFamilyCellMap().values()) {
for (Cell cell : list) {
if (KeyValueUtil.length(cell) > maxKeyValueSize) {
throw new IllegalArgumentException("KeyValue size too large");
}
}
}
}
}
代码示例来源:origin: opencb/opencga
protected List<Put> getPuts(int remain) {
List<Put> puts = new LinkedList<>();
while (buffer.size() > remain) {
IndexChunk indexChunk = buffer.keySet().iterator().next();
List<Map<String, Set<String>>> sampleList = buffer.remove(indexChunk);
Iterator<Integer> sampleIterator = sampleIds.iterator();
for (Map<String, Set<String>> gtsMap : sampleList) {
Integer sampleId = sampleIterator.next();
byte[] rk = SampleIndexConverter.toRowKey(sampleId, indexChunk.chromosome, indexChunk.position);
Put put = new Put(rk);
for (Map.Entry<String, Set<String>> gtsEntry : gtsMap.entrySet()) {
put.addColumn(family, toGenotypeColumn(gtsEntry.getKey()), Bytes.toBytes(String.join(",", gtsEntry.getValue())));
put.addColumn(family, toGenotypeCountColumn(gtsEntry.getKey()), Bytes.toBytes(gtsEntry.getValue().size()));
}
if (!put.isEmpty()) {
puts.add(put);
}
}
}
return puts;
}
代码示例来源:origin: opencb/opencga
@Override
protected void map(Object key, Variant variant, Context context) throws IOException, InterruptedException {
Put put = fillGapsTask.fillGaps(variant);
if (put != null && !put.isEmpty()) {
context.write(new ImmutableBytesWritable(put.getRow()), put);
}
}
}
代码示例来源:origin: harbby/sylph
@Override
public void process(Row value)
{
Object rowkey = value.getAs(rowkeyIndex);
if (rowkey == null) {
return;
}
Put put = new Put(BytesUtil.toBytes(rowkey));
try {
for (String fieldName : schema.getFieldNames()) {
if (!config.rowkey.equals(fieldName)) {
Tuple2<String, String> tuple2 = columMapping.get(fieldName);
if (tuple2 != null) {
hbaseHelper.addColumn(tuple2.f0(), tuple2.f1(), value.getAs(fieldName), put);
}
else {
logger.warn("Field:" + fieldName + " not defined in table " + tableName);
}
}
}
if (!put.isEmpty()) {
hbaseHelper.store(put);
}
}
catch (Exception e) {
logger.error("put record to hbase fail.", e);
}
}
代码示例来源:origin: harbby/presto-connectors
if (r instanceof Put) {
Put put = (Put) r;
if (put.isEmpty()) {
throw new IllegalArgumentException("No columns to insert for #" + (posInList+1)+ " item");
代码示例来源:origin: com.aliyun.hbase/alihbase-client
/**
* Submit immediately the list of rows, whatever the server status. Kept for backward
* compatibility: it allows to be used with the batch interface that return an array of objects.
* @param task The setting and data
*/
private <CResult> AsyncRequestFuture submitAll(AsyncProcessTask task) {
RowAccess<? extends Row> rows = task.getRowAccess();
List<Action> actions = new ArrayList<>(rows.size());
// The position will be used by the processBatch to match the object array returned.
int posInList = -1;
NonceGenerator ng = this.connection.getNonceGenerator();
int highestPriority = HConstants.PRIORITY_UNSET;
for (Row r : rows) {
posInList++;
if (r instanceof Put) {
Put put = (Put) r;
if (put.isEmpty()) {
throw new IllegalArgumentException("No columns to insert for #" + (posInList+1)+ " item");
}
highestPriority = Math.max(put.getPriority(), highestPriority);
}
Action action = new Action(r, posInList, highestPriority);
setNonce(ng, r, action);
actions.add(action);
}
AsyncRequestFutureImpl<CResult> ars = createAsyncRequestFuture(task, actions, ng.getNonceGroup());
ars.groupAndSendMultiAction(actions, 1);
return ars;
}
代码示例来源:origin: GoogleCloudPlatform/cloud-bigtable-client
@Override
protected void adaptMutations(Put operation, com.google.cloud.bigtable.data.v2.models.MutationApi<?> mutation) {
if (operation.isEmpty()) {
throw new IllegalArgumentException("No columns to insert");
代码示例来源:origin: opencb/opencga
public static void fillGapsLocal(HadoopVariantStorageEngine variantStorageEngine, StudyConfiguration studyConfiguration,
Collection<Integer> sampleIds)
throws StorageEngineException, IOException {
VariantHadoopDBAdaptor dbAdaptor = variantStorageEngine.getDBAdaptor();
String variantTableName = variantStorageEngine.getVariantTableName();
Table variantsTable = dbAdaptor.getHBaseManager().getConnection().getTable(TableName.valueOf(variantTableName));
FillGapsFromVariantTask fillGapsTask = new FillGapsFromVariantTask(dbAdaptor.getHBaseManager(),
variantStorageEngine.getArchiveTableName(studyConfiguration.getStudyId()),
studyConfiguration, dbAdaptor.getGenomeHelper(), sampleIds);
fillGapsTask.pre();
ProgressLogger progressLogger = new ProgressLogger("Fill gaps:", dbAdaptor.count(new Query()).first(), 10);
for (Variant variant : dbAdaptor) {
progressLogger.increment(1, variant::toString);
Put put = fillGapsTask.fillGaps(variant);
if (put != null && !put.isEmpty()) {
variantsTable.put(put);
}
}
variantsTable.close();
fillGapsTask.post();
}
内容来源于网络,如有侵权,请联系作者删除!