private Mutation mutationFromTuple ( Tuple t ) throws IOException { 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 throw new IOException ( "null found but deletes are disabled, set " + PIG_ALLOW_DELETES + "=true in environment or allow_deletes=true in URL to enable" ) ; } else { org . apache . cassandra . thrift . Column column = new org . apache . cassandra . thrift . Column ( ) ; column . setName ( objToBB ( t . get ( 0 ) ) ) ; column . setValue ( objToBB ( t . get ( 1 ) ) ) ; column . setTimestamp ( FBUtilities . timestampMicros ( ) ) ; mutation . column_or_supercolumn = new ColumnOrSuperColumn ( ) ; mutation . column_or_supercolumn . column = column ; } return mutation ; }
compose Cassandra mutation from tuple