Package me.prettyprint.cassandra.serializers

Examples of me.prettyprint.cassandra.serializers.CompositeSerializer


    Composite endRange = new Composite();
    endRange.addComponent(0, CN_TYPE_LABEL, Composite.ComponentEquality.GREATER_THAN_EQUAL);

    SliceCounterQuery<String, Composite> sliceQuery =
        createCounterSliceQuery(CassandraDAOFactory.getKeyspace(), strSe, new CompositeSerializer());
    sliceQuery.setColumnFamily(CF_COUNTERS);
    sliceQuery.setKey(mailbox);
    sliceQuery.setRange(startRange, endRange, false, LabelConstants.MAX_LABEL_ID);

    QueryResult<CounterSlice<Composite>> r = sliceQuery.execute();
View Full Code Here


    Composite endRange = new Composite();
    endRange.addComponent(0, CN_TYPE_LABEL, Composite.ComponentEquality.EQUAL);
    endRange.addComponent(1, labelId.toString(), Composite.ComponentEquality.GREATER_THAN_EQUAL);

    SliceCounterQuery<String, Composite> sliceQuery =
        createCounterSliceQuery(CassandraDAOFactory.getKeyspace(), strSe, new CompositeSerializer());
    sliceQuery.setColumnFamily(CF_COUNTERS);
    sliceQuery.setKey(mailbox);
    sliceQuery.setRange(startRange, endRange, false, 5);

    QueryResult<CounterSlice<Composite>> r = sliceQuery.execute();
View Full Code Here

      // delete counters
      HCounterColumn<Composite> c;
     
      c = countersToCompositeColumn(labelId, CN_SUBTYPE_MESSAGES, labelCounters.getTotalMessages());
      mutator.addDeletion(mailbox, CF_COUNTERS, c.getName(), new CompositeSerializer());
     
      c = countersToCompositeColumn(labelId, CN_SUBTYPE_UNREAD, labelCounters.getTotalMessages());
      mutator.addDeletion(mailbox, CF_COUNTERS, c.getName(), new CompositeSerializer());

      // delete bytes only if ALL_MAILS
      if (labelId == ReservedLabels.ALL_MAILS.getId()) {
        c = countersToCompositeColumn(labelId, CN_SUBTYPE_BYTES, labelCounters.getTotalMessages());
        mutator.addDeletion(mailbox, CF_COUNTERS, c.getName(), new CompositeSerializer());
      }
    }
  }
View Full Code Here

  {
    Composite composite = new Composite();
    composite.addComponent(CN_TYPE_LABEL, strSe);
    composite.addComponent(labelId.toString(), strSe);
    composite.addComponent(Character.toString(subtype), strSe);
    return createCounterColumn(composite, count, new CompositeSerializer());
  }
View Full Code Here

      composite.addComponent(getCountryCode(), StringSerializer.get());
      composite.addComponent(getAdmin1Code(), StringSerializer.get());
      // extra un-escape to handle the case of "Washington, D.C."
      composite.addComponent(StringEscapeUtils.unescapeCsv(getAsciiName()), StringSerializer.get());
      HColumn<Composite,String> col =
        HFactory.createColumn(composite, getTimezone(), new CompositeSerializer(), StringSerializer.get());
      return col;
    }
View Full Code Here

      this.key = key;
      this.start = start;
      this.end = end;

      SliceQuery<String,Composite,String> sliceQuery =
        HFactory.createSliceQuery(tutorialKeyspace, StringSerializer.get(), new CompositeSerializer(), StringSerializer.get());
      sliceQuery.setColumnFamily("CountryStateCity");
      sliceQuery.setKey(key);

      sliceIterator = new ColumnSliceIterator(sliceQuery, start, end, false);
View Full Code Here

                    break;
                case COUNTER_TYPE:
                    byteBuffer = LongSerializer.get().toByteBuffer(Long.parseLong(genericValue));
                    break;
                case COMPOSITE_TYPE:
                    byteBuffer = new CompositeSerializer().toByteBuffer(createComposite(genericType));
                    break;
                default:
                    byteBuffer = BytesArraySerializer.get().toByteBuffer(genericValue.getBytes());
                    break;
            }
View Full Code Here

            .getTypeName()));

    Keyspace keyspace = HFactory.createKeyspace("compositeKeyspace", cluster);

    SliceQuery<String, Composite, String> query = HFactory.createSliceQuery(keyspace, StringSerializer.get(),
        new CompositeSerializer(), StringSerializer.get());
    query.setColumnFamily("columnFamilyWithCompositeType");
    query.setKey("row1");

    // Create a composite search range
    Composite start = new Composite();
    start.addComponent(11L, LongSerializer.get());
    start.addComponent("ab", StringSerializer.get());
    start.addComponent(0, IntegerSerializer.get());

    Composite finish = new Composite();
    finish.addComponent(11L, LongSerializer.get());
    finish.addComponent("ab", StringSerializer.get());
    finish.addComponent(Integer.MAX_VALUE, IntegerSerializer.get());
    query.setRange(start, finish, false, 100);

    // Now search.
    ColumnSlice<Composite, String> columnSlice = query.execute().get();
    assertThat(columnSlice.getColumns().size(), is(2));
    assertThat(columnSlice.getColumns().get(0).getValue(), is("v2"));
    assertThat(columnSlice.getColumns().get(1).getValue(), is("v3"));

    SliceQuery<String, Composite, String> query2 = HFactory.createSliceQuery(keyspace, StringSerializer.get(),
        new CompositeSerializer(), StringSerializer.get());
    query2.setColumnFamily("columnFamilyWithCompositeType");
    query2.setKey("row1");

    // Create a composite search range
    Composite start2 = new Composite();
View Full Code Here

        cluster.describeKeyspace("compositeKeyspace").getCfDefs().get(1).getKeyValidationClass(),
        is("org.apache.cassandra.db.marshal.CompositeType(org.apache.cassandra.db.marshal.LongType,org.apache.cassandra.db.marshal.UTF8Type)"));

    Keyspace keyspace = HFactory.createKeyspace("compositeKeyspace", cluster);

    SliceQuery<Composite, String, String> query = HFactory.createSliceQuery(keyspace, new CompositeSerializer(),
        StringSerializer.get(), StringSerializer.get());
    Composite key = new Composite();
    key.addComponent(12L, LongSerializer.get());
    key.addComponent("az", StringSerializer.get());
    query.setColumnFamily("columnFamilyWithRowKeyCompositeType").setKey(key);
View Full Code Here

TOP

Related Classes of me.prettyprint.cassandra.serializers.CompositeSerializer

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.