本文整理汇总了Java中org.apache.accumulo.core.data.Mutation.getRow方法的典型用法代码示例。如果您正苦于以下问题:Java Mutation.getRow方法的具体用法?Java Mutation.getRow怎么用?Java Mutation.getRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.accumulo.core.data.Mutation
的用法示例。
在下文中一共展示了Mutation.getRow方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: putArray
import org.apache.accumulo.core.data.Mutation; //导入方法依赖的package包/类
private int putArray(Mutation m, int count, Object o, Pair<Text, Text> col, String fieldName) {
// First of all we delete array field on accumulo store
Text rowKey = new Text(m.getRow());
Query<K, T> query = newQuery();
query.setFields(fieldName);
query.setStartKey((K)rowKey.toString());
query.setEndKey((K)rowKey.toString());
deleteByQuery(query);
flush();
if (o == null){
return 0;
}
List<?> array = (List<?>) o; // both GenericArray and DirtyListWrapper
int j = 0;
for (Object item : array) {
m.put(col.getFirst(), new Text(toBytes(j++)), new Value(toBytes(item)));
count++;
}
return count;
}
示例2: write
import org.apache.accumulo.core.data.Mutation; //导入方法依赖的package包/类
@Override
public void write(Text table, Mutation mutation) throws IOException, InterruptedException {
TreeMap<Key,Value> buffer = getBuffer(table);
int mutationSize = 0;
for (ColumnUpdate update : mutation.getUpdates()) {
Key k = new Key(mutation.getRow(), update.getColumnFamily(), update.getColumnQualifier(), update.getColumnVisibility(), update.getTimestamp(),
update.isDeleted());
Value v = new Value(update.getValue());
// TODO account for object overhead
mutationSize += k.getSize();
mutationSize += v.getSize();
buffer.put(k, v);
}
size += mutationSize;
long bufferSize = bufferSizes.get(table);
// TODO use a MutableLong instead
bufferSize += mutationSize;
bufferSizes.put(table, bufferSize);
while (size >= maxSize) {
flushLargestTable();
}
}
示例3: addMutation
import org.apache.accumulo.core.data.Mutation; //导入方法依赖的package包/类
/**
* Signs the given mutation and then write it to Accumulo.
*
* @param mutation
* The mutation to sign.
*/
@Override
public void addMutation(Mutation mutation) throws MutationsRejectedException {
Mutation signedMutation = new Mutation(mutation.getRow());
// Sign the entries.
for (ColumnUpdate update : mutation.getUpdates()) {
if (update.isDeleted()) {
if (signatureConfig.destination == Destination.COLUMN_VISIBILITY) {
throw new IllegalArgumentException("cannot delete entries when the signature is stored in the column visibility");
}
if (update.hasTimestamp()) {
signedMutation.putDelete(update.getColumnFamily(), update.getColumnQualifier(), new ColumnVisibility(update.getColumnVisibility()),
update.getTimestamp());
} else {
signedMutation.putDelete(update.getColumnFamily(), update.getColumnQualifier(), new ColumnVisibility(update.getColumnVisibility()));
}
} else {
Entry<Key,Value> signedEntry = signer.sign(new MutableEntry(mutation.getRow(), update).toEntry(), update.hasTimestamp());
Key signedKey = signedEntry.getKey();
if (update.hasTimestamp()) {
signedMutation.put(signedKey.getColumnFamily(), signedKey.getColumnQualifier(), signedKey.getColumnVisibilityParsed(), signedKey.getTimestamp(),
signedEntry.getValue());
} else {
signedMutation.put(signedKey.getColumnFamily(), signedKey.getColumnQualifier(), signedKey.getColumnVisibilityParsed(), signedEntry.getValue());
}
}
}
// Write the signed mutations.
if (signatureTableWriter != null) {
tableWriter.addMutation(mutation);
signatureTableWriter.addMutation(signedMutation);
} else {
tableWriter.addMutation(signedMutation);
}
}
示例4: createTestData1
import org.apache.accumulo.core.data.Mutation; //导入方法依赖的package包/类
private void createTestData1() {
List<Tag> tags = Collections.singletonList(new Tag("host", "host1"));
for (long i = 0; i < 1000; i += 100) {
Metric m = new Metric("sys.loadAvg", i, .2, tags);
Mutation mutation = MetricAdapter.toMutation(m);
for (ColumnUpdate cu : mutation.getUpdates()) {
Key key = new Key(mutation.getRow(), cu.getColumnFamily(), cu.getColumnQualifier(),
cu.getColumnVisibility(), cu.getTimestamp());
testData1.put(key, new Value(cu.getValue()));
}
}
}
示例5: put
import org.apache.accumulo.core.data.Mutation; //导入方法依赖的package包/类
void put(Map<Key, Value> testData, Metric m) {
Mutation mutation = MetricAdapter.toMutation(m);
for (ColumnUpdate cu : mutation.getUpdates()) {
Key key = new Key(mutation.getRow(), cu.getColumnFamily(), cu.getColumnQualifier(),
cu.getColumnVisibility(), cu.getTimestamp());
testData.put(key, new Value(cu.getValue()));
}
}
示例6: putMap
import org.apache.accumulo.core.data.Mutation; //导入方法依赖的package包/类
private int putMap(Mutation m, int count, Schema valueType, Object o, Pair<Text, Text> col, String fieldName) throws GoraException {
// First of all we delete map field on accumulo store
Text rowKey = new Text(m.getRow());
Query<K, T> query = newQuery();
query.setFields(fieldName);
query.setStartKey((K)rowKey.toString());
query.setEndKey((K)rowKey.toString());
deleteByQuery(query);
flush();
if (o == null){
return 0;
}
Set<?> es = ((Map<?, ?>)o).entrySet();
for (Object entry : es) {
Object mapKey = ((Entry<?, ?>) entry).getKey();
Object mapVal = ((Entry<?, ?>) entry).getValue();
if ((o instanceof DirtyMapWrapper && ((DirtyMapWrapper<?, ?>)o).isDirty())
|| !(o instanceof DirtyMapWrapper)) { //mapVal instanceof Dirtyable && ((Dirtyable)mapVal).isDirty()) {
m.put(col.getFirst(), new Text(toBytes(mapKey)), new Value(toBytes(valueType, mapVal)));
count++;
}
// TODO map value deletion
}
return count;
}
示例7: writeMutation
import org.apache.accumulo.core.data.Mutation; //导入方法依赖的package包/类
/**
* Writes a mutation to the specified table. If the mutation is meant to delete then the mutation will
* be transformed to a delete mutation.
* @param table the table to write to.
* @param mutation the {@link mutation}.
* @param context the {@link Context}.
* @param isDelete {@code true} if the mutation should be a delete mutation. {@code false} otherwise.
* @throws IOException
* @throws InterruptedException
*/
private static void writeMutation(final Text table, final Mutation mutation, final Context context, final boolean isDelete) throws IOException, InterruptedException {
if (isDelete) {
final List<ColumnUpdate> updates = mutation.getUpdates();
final ColumnUpdate columnUpdate = updates.get(0);
final ColumnVisibility cv = columnUpdate.getColumnVisibility() != null ? new ColumnVisibility(columnUpdate.getColumnVisibility()) : null;
final Mutation deleteMutation = new Mutation(new Text(mutation.getRow()));
deleteMutation.putDelete(columnUpdate.getColumnFamily(), columnUpdate.getColumnQualifier(), cv, columnUpdate.getTimestamp());
context.write(table, deleteMutation);
} else {
context.write(table, mutation);
}
}