Package org.apache.cassandra.thrift

Examples of org.apache.cassandra.thrift.ColumnOrSuperColumn$ColumnOrSuperColumnStandardSchemeFactory


        {
            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;
    }
View Full Code Here


                        throw new IOException("SuperColumn deletion attempted with empty bag, but deletes are disabled, set " + PIG_ALLOW_DELETES + "=true to enable");
                }
                else
                {
                    sc.columns = columns;
                    mutation.column_or_supercolumn = new ColumnOrSuperColumn();
                    mutation.column_or_supercolumn.super_column = sc;
                }
            }
            else
                mutation = mutationFromTuple(pair);
View Full Code Here

        {
            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;
    }
View Full Code Here

                            PIG_ALLOW_DELETES + "=true in environment or allow_deletes=true in URL to enable");
                }
                else
                {
                    sc.columns = columns;
                    mutation.column_or_supercolumn = new ColumnOrSuperColumn();
                    mutation.column_or_supercolumn.super_column = sc;
                }
            }
            else
                mutation = mutationFromTuple(pair);
View Full Code Here

                column.setTimestamp(timestamp);
                columns.add(column);
            }

            SuperColumn superColumn = new SuperColumn(bytes(superColumnName), columns);
            mutation.setColumn_or_supercolumn(new ColumnOrSuperColumn().setSuper_column(superColumn));
            mutationList.add(mutation);
        } else {
            for (Map.Entry<String, ByteBuffer> entry : mutations.entrySet()) {
                Column column = new Column(bytes(entry.getKey()));
                column.setValue(entry.getValue());
                column.setTimestamp(timestamp);
                Mutation mutation = new Mutation();
                mutation.setColumn_or_supercolumn(new ColumnOrSuperColumn().setColumn(column));
                mutationList.add(mutation);
            }
        }
        innerMutationMap.put(columnFamily, mutationList);
        result.put(bytes(rowKey), innerMutationMap);
View Full Code Here

                       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
                   {
                       org.apache.cassandra.thrift.Column column = new org.apache.cassandra.thrift.Column();
                       column.name = marshallers.get(0).decompose((pair.get(0)));
                       if (validators.get(column.name) == null)
                           // Have to special case BytesType to convert DataByteArray into ByteBuffer
                           if (marshallers.get(1) instanceof BytesType)
                               column.value = objToBB(pair.get(1));
                           else
                               column.value = marshallers.get(1).decompose(pair.get(1));
                       else
                           column.value = validators.get(column.name).decompose(pair.get(1));
                       column.setTimestamp(System.currentTimeMillis() * 1000);
                       mutation.column_or_supercolumn = new ColumnOrSuperColumn();
                       mutation.column_or_supercolumn.column = column;
                   }
               }
               mutationList.add(mutation);
            }
View Full Code Here

  public InternalCacheEntry load(Object key) throws CacheLoaderException {
    String hashKey = hashKey(key);
    Cassandra.Client cassandraClient = null;
    try {
      cassandraClient = dataSource.getConnection();
      ColumnOrSuperColumn column = cassandraClient.get(config.keySpace, hashKey, entryColumnPath, readConsistencyLevel);
      InternalCacheEntry ice = unmarshall(column.getColumn().getValue(), key);
      if (ice != null && ice.isExpired()) {
        remove(key);
        return null;
      }
      return ice;
View Full Code Here

      if (column != null) { // Single column delete
        deletion.setPredicate(new SlicePredicate().setColumn_names(Arrays.asList(new byte[][] { column })));
      } // else Delete entire column family or supercolumn
      columnFamilyMutations.add(new Mutation().setDeletion(deletion));
    } else { // Insert/update
      ColumnOrSuperColumn cosc = new ColumnOrSuperColumn();
      if(superColumn!=null) {
        List<Column> columns = new ArrayList<Column>();
        columns.add(new Column(column, value, System.currentTimeMillis()));
        cosc.setSuper_column(new SuperColumn(superColumn, columns));
      } else {
        cosc.setColumn(new Column(column, value, System.currentTimeMillis()));
      }
      columnFamilyMutations.add(new Mutation().setColumn_or_supercolumn(cosc));
    }
  }
View Full Code Here

                column.setTimestamp(timestamp);
                columns.add(column);
            }

            SuperColumn superColumn = new SuperColumn(bytes(superColumnName), columns);
            mutation.setColumn_or_supercolumn(new ColumnOrSuperColumn().setSuper_column(superColumn));
            mutationList.add(mutation);
        } else {
            for (Map.Entry<String, ByteBuffer> entry : mutations.entrySet()) {
                Column column = new Column(bytes(entry.getKey()));
                column.setValue(entry.getValue());
                column.setTimestamp(timestamp);
                Mutation mutation = new Mutation();
                mutation.setColumn_or_supercolumn(new ColumnOrSuperColumn().setColumn(column));
                mutationList.add(mutation);
            }
        }
        innerMutationMap.put(columnFamily, mutationList);
        result.put(bytes(rowKey), innerMutationMap);
View Full Code Here

                                    new TBinaryProtocol(
                                        new TFramedTransportFactory().openTransport(
                                            InetAddress.getLocalHost().getHostName(), 9170)));
        client.set_keyspace(ksName);
        Mutation mutation = new Mutation();
        ColumnOrSuperColumn cosc = new ColumnOrSuperColumn();
        cosc.setColumn(getColumnForInsert("v1", 3));
        mutation.setColumn_or_supercolumn(cosc);
        client.batch_mutate(
            Collections.singletonMap(ByteBufferUtil.bytes(3),
                                     Collections.singletonMap(cfName,
                                                              Collections.singletonList(mutation))),
View Full Code Here

TOP

Related Classes of org.apache.cassandra.thrift.ColumnOrSuperColumn$ColumnOrSuperColumnStandardSchemeFactory

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.