You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Pinak Pani <ni...@gmail.com> on 2014/09/28 08:08:03 UTC

A trigger that modifies the current Mutation

Hi,

I wanted to create a trigger that alters the current mutation. For example,
I wanted to, say, iterate through the ColumnFamily in augment method and
look for all the fields that are of type text or varchar and change them to
upper case. I am not sure how to do that. Can someone help me?

Basically, this is what I wanted to do:

public class AllCapsTrigger implements ITrigger {

  public Collection<Mutation> augment(ByteBuffer key, ColumnFamily cf) {
    for(Cell cell: cf){
      if(cell.value().hasRemaining()){
        System.out.println("Value:  " + new String(cell.value().array(),
StandardCharsets.UTF_8));

        /**
         * Check if cell is of type text/varchar
         * Set cell value to upper case of what it has
         **/
      }
    }

    return null;
  }
}

Thanks for reading this.

Regards,
Pinak

Re: A trigger that modifies the current Mutation

Posted by Robert Coli <rc...@eventbrite.com>.
On Sat, Sep 27, 2014 at 11:08 PM, Pinak Pani <
nishant.has.a.question@gmail.com> wrote:

> I wanted to create a trigger that alters the current mutation.
>

(ObMetaAside : Dear God... why?)

Triggers will probably not survive in their current form. If I was planning
to use them for anything, I would comprehensively avail myself of the state
of their development...

=Rob