當前位置: 首頁>>代碼示例>>Java>>正文


Java Mutation.getRow方法代碼示例

本文整理匯總了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;
  }
 
開發者ID:jianglibo,項目名稱:gora-boot,代碼行數:23,代碼來源:AccumuloStore.java

示例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();
  }
}
 
開發者ID:apache,項目名稱:accumulo-wikisearch,代碼行數:25,代碼來源:BufferingRFileRecordWriter.java

示例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);
  }
}
 
開發者ID:mit-ll,項目名稱:PACE,代碼行數:45,代碼來源:SignedBatchWriter.java

示例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()));
        }
    }
}
 
開發者ID:NationalSecurityAgency,項目名稱:timely,代碼行數:14,代碼來源:DownsampleIteratorTest.java

示例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()));
    }
}
 
開發者ID:NationalSecurityAgency,項目名稱:timely,代碼行數:9,代碼來源:DownsampleIteratorTest.java

示例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;
  }
 
開發者ID:jianglibo,項目名稱:gora-boot,代碼行數:28,代碼來源:AccumuloStore.java

示例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);
    }
}
 
開發者ID:apache,項目名稱:incubator-rya,代碼行數:23,代碼來源:MergeToolMapper.java


注:本文中的org.apache.accumulo.core.data.Mutation.getRow方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。