Examples of Mutation


Examples of org.apache.accumulo.core.data.Mutation

     */
    public static <C> DBItemTransformer<Mutation, C> allCellGroupsToSingleRowId
            (final String rowId) {
        return new DBItemTransformer<Mutation, C>() {
            public List<Mutation> apply(CellGroup<C> group) throws CellExtractorException {
               Mutation m1 = new Mutation(rowId);
               List<Mutation> mutations = Lists.newArrayList();
                for (C cell : group.getInternalList()) {
                    String colFam = CellReflector.getColFam(cell);
                    String qual = CellReflector.getLabelAsString(cell);
                    byte[] value = CellReflector.getValueBytesIfPrimative(cell);
                    m1.put(new Text(colFam), new Text(qual),new Value(value));
                }
                mutations.add(m1);
                return mutations;
            }
        };
View Full Code Here

Examples of org.apache.accumulo.core.data.Mutation

      return;
   
    HashMap<Text,ColumnVisibility> vizMap = new HashMap<Text,ColumnVisibility>();
   
    for (Map.Entry<ByteBuffer,List<ColumnUpdate>> entry : cells.entrySet()) {
      Mutation m = new Mutation(new Text(ByteBufferUtil.toBytes(entry.getKey())));
     
      for (ColumnUpdate update : entry.getValue()) {
        ColumnVisibility viz = EMPTY_VIS;
        if (update.isSetColVisibility()) {
          Text vizText = new Text(update.getColVisibility());
          viz = vizMap.get(vizText);
          if (viz == null) {
            vizMap.put(vizText, viz = new ColumnVisibility(vizText));
          }
        }
        byte[] value = new byte[0];
        if (update.isSetValue())
          value = update.getValue();
        if (update.isSetTimestamp()) {
          if (update.isSetDeleteCell()) {
            m.putDelete(new Text(update.getColFamily()), new Text(update.getColQualifier()), viz, update.getTimestamp());
          } else {
              m.put(new Text(update.getColFamily()), new Text(update.getColQualifier()), viz, update.getTimestamp(), new Value(value));
            }
        } else {
          if (update.isSetDeleteCell()) {
            m.putDelete(new Text(update.getColFamily()), new Text(update.getColQualifier()), viz);
          } else {
            m.put(new Text(update.getColFamily()), new Text(update.getColQualifier()), viz, new Value(value));
          }
        }
      }
      try {
        bwpe.writer.addMutation(m);
View Full Code Here

Examples of org.apache.accumulo.core.data.Mutation

          Key key = importIterator.getTopKey();
          Value value = importIterator.getTopValue();
          if (setTime) {
            key.setTimestamp(time);
          }
          Mutation mutation = new Mutation(key.getRow());
          if (!key.isDeleted()) {
            mutation.put(key.getColumnFamily(), key.getColumnQualifier(),
                new ColumnVisibility(key.getColumnVisibilityData().toArray()),
                key.getTimestamp(), value);
          } else {
            mutation.putDelete(key.getColumnFamily(), key.getColumnQualifier(),
                new ColumnVisibility(key.getColumnVisibilityData().toArray()),
                key.getTimestamp());
          }
          table.addMutation(mutation);
          importIterator.next();
View Full Code Here

Examples of org.apache.cassandra.avro.Mutation

        Map<ByteBuffer,AbstractType> validators = getValidatorMap(cfDef);
        try
        {
            for (Tuple pair : pairs)
            {
               Mutation mutation = new Mutation();
               if (DataType.findType(pair.get(1)) == DataType.BAG) // supercolumn
               {
                   org.apache.cassandra.avro.SuperColumn sc = new org.apache.cassandra.avro.SuperColumn();
                   sc.name = objToBB(pair.get(0));
                   ArrayList<org.apache.cassandra.avro.Column> columns = new ArrayList<org.apache.cassandra.avro.Column>();
View Full Code Here

Examples of org.apache.cassandra.avro.Mutation

            Column c = new Column();
            c.name = ByteBuffer.wrap(Arrays.copyOf(word.getBytes(), word.getLength()));
            c.value = ByteBufferUtil.bytes(String.valueOf(sum));
            c.timestamp = System.currentTimeMillis() * 1000;

            Mutation m = new Mutation();
            m.column_or_supercolumn = new ColumnOrSuperColumn();
            m.column_or_supercolumn.column = c;
            return m;
        }
View Full Code Here

Examples of org.apache.cassandra.db.Mutation

    static final String keyString = UUIDGen.getTimeUUID().toString();
    public static class CommitlogExecutor implements Runnable {
        public void run() {
            String ks = "Keyspace1";
            ByteBuffer key = ByteBufferUtil.bytes(keyString);
            Mutation mutation = new Mutation(ks, key);
            mutation.add("Standard1", Util.cellname("name"), ByteBufferUtil.bytes("value"),
                    System.currentTimeMillis());
            CommitLog.instance.add(mutation);
        }
View Full Code Here

Examples of org.apache.cassandra.hadoop.avro.Mutation

        Map<ByteBuffer,AbstractType> validators = getValidatorMap(cfDef);
        try
        {
            for (Tuple pair : pairs)
            {
               Mutation mutation = new Mutation();
               if (DataType.findType(pair.get(1)) == DataType.BAG) // supercolumn
               {
                   org.apache.cassandra.hadoop.avro.SuperColumn sc = new org.apache.cassandra.hadoop.avro.SuperColumn();
                   sc.name = objToBB(pair.get(0));
                   ArrayList<org.apache.cassandra.hadoop.avro.Column> columns = new ArrayList<org.apache.cassandra.hadoop.avro.Column>();
View Full Code Here

Examples of org.apache.cassandra.thrift.Mutation

   * Add an Column insertion (or update) to the batch mutation request.
   */
  public ThrottlingBatchMutation<K> addInsertion(K key,
      List<String> columnFamilies, Column column)
  {
    Mutation mutation = new Mutation();
    mutation.setColumn_or_supercolumn(new ColumnOrSuperColumn()
        .setColumn(column));
    addMutation(key, columnFamilies, mutation);
    return this;
  }
View Full Code Here

Examples of org.apache.cassandra.thrift.Mutation

   * Add a SuperColumn insertion (or update) to the batch mutation request.
   */
  public ThrottlingBatchMutation<K> addSuperInsertion(K key,
      List<String> columnFamilies, SuperColumn superColumn)
  {
    Mutation mutation = new Mutation();
    mutation.setColumn_or_supercolumn(new ColumnOrSuperColumn()
        .setSuper_column(superColumn));
    addMutation(key, columnFamilies, mutation);
    return this;
  }
View Full Code Here

Examples of org.apache.cassandra.thrift.Mutation

   * Add a ColumnCounter insertion (or update)
   */
  public ThrottlingBatchMutation<K> addCounterInsertion(K key,
      List<String> columnFamilies, CounterColumn counterColumn)
  {
    Mutation mutation = new Mutation();
    mutation.setColumn_or_supercolumn(new ColumnOrSuperColumn()
        .setCounter_column(counterColumn));
    addMutation(key, columnFamilies, mutation);
    return this;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.