Package org.apache.cassandra.thrift

Examples of org.apache.cassandra.thrift.Deletion


    for (int i = 0; i < 10; i++) {
      SlicePredicate slicePredicate = new SlicePredicate();
      for (int j = 0; j < 10; j++) {
        slicePredicate.addToColumn_names(StringSerializer.get().toByteBuffer("testBatchMutateColumn_" + j));
      }
      Deletion deletion = new Deletion(connectionManager.createClock());
      deletion.setPredicate(slicePredicate);
      batchMutation.addDeletion("testBatchMutateColumn_" + i, columnFamilies, deletion);
    }
    keyspace.batchMutate(batchMutation);
    // make sure the values are gone
    for (int i = 0; i < 10; i++) {
View Full Code Here


      }
    }
    SlicePredicate slicePredicate = new SlicePredicate();
    slicePredicate.addToColumn_names(StringSerializer.get().toByteBuffer("deleteThroughInserBatch_col"));

    Deletion deletion = new Deletion(connectionManager.createClock());
    deletion.setPredicate(slicePredicate);

    batchMutation.addDeletion("deleteThroughInserBatch_key", columnFamilies, deletion);
    keyspace.batchMutate(batchMutation);
    try {
      keyspace.getColumn("deleteThroughInserBatch_key", sta1);
View Full Code Here

    return this;
  }

  public Mutate deleteAll(String columnFamily) {
    Deletion deletion = new Deletion();
    deletion.setTimestamp(Long.MAX_VALUE); //TODO: check this
    deletion.predicate = new SlicePredicate();
    SliceRange sliceRange =
      new SliceRange(new byte[0], new byte[0], false, Integer.MAX_VALUE);
    deletion.predicate.slice_range = sliceRange;
    Mutation mutation = new Mutation();
View Full Code Here

    return this;
  }


  public Mutate delete(String columnFamily, String columnName) {
    Deletion deletion = new Deletion().setTimestamp(Long.MAX_VALUE);
    // TODO: This will also probably be slow. Try to group
    // deletes together
    deletion.predicate = new SlicePredicate();
    deletion.predicate.addToColumn_names(ByteUtils.toBytes(columnName));
View Full Code Here

    return this;
  }

  public Mutate delete(String superColumnFamily, String superColumnName,
      String columnName) {
    Deletion deletion = new Deletion().setTimestamp(Long.MAX_VALUE);
    // TODO: This will also probably be slow. Try to group
    // deletes together
    deletion.predicate = new SlicePredicate();
    deletion.super_column = ByteUtils.toBytes(superColumnName);
    deletion.predicate.addToColumn_names(ByteUtils.toBytes(columnName));
View Full Code Here

                       column.setTimestamp(System.currentTimeMillis() * 1000);
                       columns.add(column);
                   }
                   if (columns.isEmpty()) // a deletion
                   {
                       mutation.deletion = new Deletion();
                       mutation.deletion.super_column = objToBB(pair.get(0));
                       mutation.deletion.setTimestamp(System.currentTimeMillis() * 1000);
                   }
                   else
                   {
                       sc.columns = columns;
                       mutation.column_or_supercolumn = new ColumnOrSuperColumn();
                       mutation.column_or_supercolumn.super_column = sc;
                   }
               }
               else // assume column since it couldn't be anything else
               {
                   if (pair.get(1) == null)
                   {
                       mutation.deletion = new Deletion();
                       mutation.deletion.predicate = new org.apache.cassandra.thrift.SlicePredicate();
                       mutation.deletion.predicate.column_names = Arrays.asList(objToBB(pair.get(0)));
                       mutation.deletion.setTimestamp(System.currentTimeMillis() * 1000);
                   }
                   else
View Full Code Here

        Mutation mutation = new Mutation();
        if (t.get(1) == null)
        {
            if (allow_deletes)
            {
                mutation.deletion = new Deletion();
                mutation.deletion.predicate = new org.apache.cassandra.thrift.SlicePredicate();
                mutation.deletion.predicate.column_names = Arrays.asList(objToBB(t.get(0)));
                mutation.deletion.setTimestamp(FBUtilities.timestampMicros());
            }
            else
View Full Code Here

                }
                if (columns.isEmpty())
                {
                    if (allow_deletes)
                    {
                        mutation.deletion = new Deletion();
                        mutation.deletion.super_column = objToBB(pair.get(0));
                        mutation.deletion.setTimestamp(FBUtilities.timestampMicros());
                    }
                    else
                        throw new IOException("SuperColumn deletion attempted with empty bag, but deletes are disabled, set " + PIG_ALLOW_DELETES + "=true to enable");
View Full Code Here

        Mutation mutation = new Mutation();
        if (t.get(1) == null)
        {
            if (allow_deletes)
            {
                mutation.deletion = new Deletion();
                mutation.deletion.predicate = new org.apache.cassandra.thrift.SlicePredicate();
                mutation.deletion.predicate.column_names = Arrays.asList(objToBB(t.get(0)));
                mutation.deletion.setTimestamp(FBUtilities.timestampMicros());
            }
            else
View Full Code Here

                }
                if (columns.isEmpty())
                {
                    if (allow_deletes)
                    {
                        mutation.deletion = new Deletion();
                        mutation.deletion.super_column = objToBB(pair.get(0));
                        mutation.deletion.setTimestamp(FBUtilities.timestampMicros());
                    }
                    else
                        throw new IOException("SuperColumn deletion attempted with empty bag, but deletes are disabled, set " + PIG_ALLOW_DELETES + "=true to enable");
View Full Code Here

TOP

Related Classes of org.apache.cassandra.thrift.Deletion

Copyright © 2018 www.massapicom. 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.