本文整理匯總了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);
}
}