Java Code Examples for org.apache.cassandra.utils.ByteBufferUtil

The following examples show how to use org.apache.cassandra.utils.ByteBufferUtil. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: stratio-cassandra   Source File: KeyspaceTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testGetSliceNoMatch() throws Throwable
{
    Keyspace keyspace = Keyspace.open("Keyspace1");
    ColumnFamily cf = ArrayBackedSortedColumns.factory.create("Keyspace1", "Standard2");
    cf.addColumn(column("col1", "val1", 1));
    Mutation rm = new Mutation("Keyspace1", ByteBufferUtil.bytes("row1000"), cf);
    rm.apply();

    validateGetSliceNoMatch(keyspace);
    keyspace.getColumnFamilyStore("Standard2").forceBlockingFlush();
    validateGetSliceNoMatch(keyspace);

    Collection<SSTableReader> ssTables = keyspace.getColumnFamilyStore("Standard2").getSSTables();
    assertEquals(1, ssTables.size());
    ssTables.iterator().next().forceFilterFailures();
    validateGetSliceNoMatch(keyspace);
}
 
Example 2
Source Project: stratio-cassandra   Source File: ScrubTest.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Tests CASSANDRA-6892 (key aliases being used improperly for validation)
 */
@Test
public void testColumnNameEqualToDefaultKeyAlias() throws ExecutionException, InterruptedException
{
    Keyspace keyspace = Keyspace.open("Keyspace1");
    ColumnFamilyStore cfs = keyspace.getColumnFamilyStore("UUIDKeys");

    ColumnFamily cf = ArrayBackedSortedColumns.factory.create("Keyspace1", "UUIDKeys");
    cf.addColumn(column(CFMetaData.DEFAULT_KEY_ALIAS, "not a uuid", 1L));
    Mutation mutation = new Mutation("Keyspace1", ByteBufferUtil.bytes(UUIDGen.getTimeUUID()), cf);
    mutation.applyUnsafe();
    cfs.forceBlockingFlush();
    CompactionManager.instance.performScrub(cfs, false);

    assertEquals(1, cfs.getSSTables().size());
}
 
Example 3
Source Project: stratio-cassandra   Source File: ColumnFamilyStoreTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
// create two sstables, and verify that we only deserialize data from the most recent one
public void testTimeSortedQuery()
{
    Keyspace keyspace = Keyspace.open("Keyspace1");
    ColumnFamilyStore cfs = keyspace.getColumnFamilyStore("Standard1");
    cfs.truncateBlocking();

    Mutation rm;
    rm = new Mutation("Keyspace1", ByteBufferUtil.bytes("key1"));
    rm.add("Standard1", cellname("Column1"), ByteBufferUtil.bytes("asdf"), 0);
    rm.apply();
    cfs.forceBlockingFlush();

    rm = new Mutation("Keyspace1", ByteBufferUtil.bytes("key1"));
    rm.add("Standard1", cellname("Column1"), ByteBufferUtil.bytes("asdf"), 1);
    rm.apply();
    cfs.forceBlockingFlush();

    cfs.getRecentSSTablesPerReadHistogram(); // resets counts
    cfs.getColumnFamily(Util.namesQueryFilter(cfs, Util.dk("key1"), "Column1"));
    assertEquals(1, cfs.getRecentSSTablesPerReadHistogram()[0]);
}
 
Example 4
Source Project: stratio-cassandra   Source File: TypeParser.java    License: Apache License 2.0 6 votes vote down vote up
public static String stringifyCollectionsParameters(Map<ByteBuffer, ? extends CollectionType> collections)
{
    StringBuilder sb = new StringBuilder();
    sb.append('(');
    boolean first = true;
    for (Map.Entry<ByteBuffer, ? extends CollectionType> entry : collections.entrySet())
    {
        if (!first)
            sb.append(',');

        first = false;
        sb.append(ByteBufferUtil.bytesToHex(entry.getKey())).append(":");
        sb.append(entry.getValue());
    }
    sb.append(')');
    return sb.toString();
}
 
Example 5
Source Project: stratio-cassandra   Source File: BatchlogManager.java    License: Apache License 2.0 6 votes vote down vote up
private List<Mutation> replayingMutations() throws IOException
{
    DataInputStream in = new DataInputStream(ByteBufferUtil.inputStream(data));
    int size = in.readInt();
    List<Mutation> mutations = new ArrayList<>(size);
    for (int i = 0; i < size; i++)
    {
        Mutation mutation = Mutation.serializer.deserialize(in, version);

        // Remove CFs that have been truncated since. writtenAt and SystemTable#getTruncatedAt() both return millis.
        // We don't abort the replay entirely b/c this can be considered a success (truncated is same as delivered then
        // truncated.
        for (UUID cfId : mutation.getColumnFamilyIds())
            if (writtenAt <= SystemKeyspace.getTruncatedAt(cfId))
                mutation = mutation.without(cfId);

        if (!mutation.isEmpty())
            mutations.add(mutation);
    }
    return mutations;
}
 
Example 6
private void maybeReadNext() throws IOException
{
    if (next != null)
        return;

    int length = in.readShort() & 0xFFFF;
    // Note that empty is ok because it marks the end of row
    if (length == 0)
    {
        next = ByteBufferUtil.EMPTY_BYTE_BUFFER;
        return;
    }

    byte[] b = new byte[length];
    in.readFully(b);
    next = ByteBuffer.wrap(b);
}
 
Example 7
Source Project: stratio-cassandra   Source File: IndexSummaryTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testAddEmptyKey() throws Exception
{
    IPartitioner p = new RandomPartitioner();
    try (IndexSummaryBuilder builder = new IndexSummaryBuilder(1, 1, BASE_SAMPLING_LEVEL))
    {
        builder.maybeAddEntry(p.decorateKey(ByteBufferUtil.EMPTY_BYTE_BUFFER), 0);
        IndexSummary summary = builder.build(p);
        assertEquals(1, summary.size());
        assertEquals(0, summary.getPosition(0));
        assertArrayEquals(new byte[0], summary.getKey(0));

        DataOutputBuffer dos = new DataOutputBuffer();
        IndexSummary.serializer.serialize(summary, dos, false);
        DataInputStream dis = new DataInputStream(new ByteArrayInputStream(dos.toByteArray()));
        IndexSummary loaded = IndexSummary.serializer.deserialize(dis, p, false, 1, 1);

        assertEquals(1, loaded.size());
        assertEquals(summary.getPosition(0), loaded.getPosition(0));
        assertArrayEquals(summary.getKey(0), summary.getKey(0));
        summary.close();
        loaded.close();
    }
}
 
Example 8
Source Project: stratio-cassandra   Source File: ColumnConditionTest.java    License: Apache License 2.0 6 votes vote down vote up
private static boolean mapAppliesTo(ColumnCondition.CollectionBound bound, Map<ByteBuffer, ByteBuffer> conditionValues, Map<ByteBuffer, ByteBuffer> columnValues)
{
    CFMetaData cfm = CFMetaData.compile("create table foo(a int PRIMARY KEY, b map<int, int>)", "ks");
    Map<ByteBuffer, CollectionType> typeMap = new HashMap<>();
    typeMap.put(ByteBufferUtil.bytes("b"), MapType.getInstance(Int32Type.instance, Int32Type.instance, true));
    CompoundSparseCellNameType.WithCollection nameType = new CompoundSparseCellNameType.WithCollection(Collections.EMPTY_LIST, ColumnToCollectionType.getInstance(typeMap));
    ColumnDefinition definition = new ColumnDefinition(cfm, ByteBufferUtil.bytes("b"), MapType.getInstance(Int32Type.instance, Int32Type.instance, true), 0, ColumnDefinition.Kind.REGULAR);

    List<Cell> cells = new ArrayList<>(columnValues.size());
    if (columnValues != null)
    {
        for (Map.Entry<ByteBuffer, ByteBuffer> entry : columnValues.entrySet())
            cells.add(new BufferCell(nameType.create(Composites.EMPTY, definition, entry.getKey()), entry.getValue()));
    }

    return bound.mapAppliesTo(MapType.getInstance(Int32Type.instance, Int32Type.instance, true), cells.iterator(), conditionValues, bound.operator);
}
 
Example 9
Source Project: stratio-cassandra   Source File: TypeParser.java    License: Apache License 2.0 6 votes vote down vote up
public static String stringifyUserTypeParameters(String keysace, ByteBuffer typeName, List<ByteBuffer> columnNames, List<AbstractType<?>> columnTypes)
{
    StringBuilder sb = new StringBuilder();
    sb.append('(').append(keysace).append(",").append(ByteBufferUtil.bytesToHex(typeName));

    for (int i = 0; i < columnNames.size(); i++)
    {
        sb.append(',');
        sb.append(ByteBufferUtil.bytesToHex(columnNames.get(i))).append(":");

        // omit FrozenType(...) from fields because it is currently implicit
        sb.append(columnTypes.get(i).toString(true));
    }
    sb.append(')');
    return sb.toString();
}
 
Example 10
Source Project: stratio-cassandra   Source File: AbstractCompositeType.java    License: Apache License 2.0 6 votes vote down vote up
public List<CompositeComponent> deconstruct( ByteBuffer bytes )
{
    List<CompositeComponent> list = new ArrayList<CompositeComponent>();

    ByteBuffer bb = bytes.duplicate();
    readIsStatic(bb);
    int i = 0;

    while (bb.remaining() > 0)
    {
        AbstractType comparator = getComparator(i, bb);
        ByteBuffer value = ByteBufferUtil.readBytesWithShortLength(bb);

        list.add( new CompositeComponent(comparator,value) );

        byte b = bb.get(); // Ignore; not relevant here
        ++i;
    }
    return list;
}
 
Example 11
Source Project: stratio-cassandra   Source File: SSTableReaderTest.java    License: Apache License 2.0 6 votes vote down vote up
/** see CASSANDRA-5407 */
@Test
public void testGetScannerForNoIntersectingRanges()
{
    Keyspace keyspace = Keyspace.open("Keyspace1");
    ColumnFamilyStore store = keyspace.getColumnFamilyStore("Standard1");
    ByteBuffer key = ByteBufferUtil.bytes(String.valueOf("k1"));
    Mutation rm = new Mutation("Keyspace1", key);
    rm.add("Standard1", cellname("xyz"), ByteBufferUtil.bytes("abc"), 0);
    rm.apply();
    store.forceBlockingFlush();
    boolean foundScanner = false;
    for (SSTableReader s : store.getSSTables())
    {
        ISSTableScanner scanner = s.getScanner(new Range<Token>(t(0), t(1), s.partitioner), null);
        scanner.next(); // throws exception pre 5407
        foundScanner = true;
    }
    assertTrue(foundScanner);
}
 
Example 12
Source Project: stratio-cassandra   Source File: PagingState.java    License: Apache License 2.0 6 votes vote down vote up
public static PagingState deserialize(ByteBuffer bytes)
{
    if (bytes == null)
        return null;

    try
    {
        DataInputStream in = new DataInputStream(ByteBufferUtil.inputStream(bytes));
        ByteBuffer pk = ByteBufferUtil.readWithShortLength(in);
        ByteBuffer cn = ByteBufferUtil.readWithShortLength(in);
        int remaining = in.readInt();
        return new PagingState(pk, cn, remaining);
    }
    catch (IOException e)
    {
        throw new ProtocolException("Invalid value for the paging state");
    }
}
 
Example 13
Source Project: stratio-cassandra   Source File: SelectStatementTest.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Test 'clustering_1 = 1' with 2 clustering columns
 */
@Test
public void testBuildBoundWithOneEqRestrictionsAndTwoClusteringColumns() throws InvalidRequestException
{
    ByteBuffer clustering_2 = ByteBufferUtil.bytes(1);
    SingleColumnRestriction.EQ eq = new SingleColumnRestriction.EQ(toTerm(clustering_2), false);
    Restriction[] restrictions = new Restriction[] { eq, null };

    List<Composite> bounds = executeBuildBound(restrictions, Bound.START);
    assertEquals(1, bounds.size());
    assertComposite(bounds.get(0), clustering_2, EOC.START);

    bounds = executeBuildBound(restrictions, Bound.END);
    assertEquals(1, bounds.size());
    assertComposite(bounds.get(0), clustering_2, EOC.END);
}
 
Example 14
Source Project: stratio-cassandra   Source File: AbstractComposite.java    License: Apache License 2.0 6 votes vote down vote up
public ByteBuffer toByteBuffer()
{
    // This is the legacy format of composites.
    // See org.apache.cassandra.db.marshal.CompositeType for details.
    ByteBuffer result = ByteBuffer.allocate(dataSize() + 3 * size() + (isStatic() ? 2 : 0));
    if (isStatic())
        ByteBufferUtil.writeShortLength(result, CompositeType.STATIC_MARKER);

    for (int i = 0; i < size(); i++)
    {
        ByteBuffer bb = get(i);
        ByteBufferUtil.writeShortLength(result, bb.remaining());
        result.put(bb.duplicate());
        result.put((byte)0);
    }
    result.flip();
    return result;
}
 
Example 15
Source Project: stratio-cassandra   Source File: BytesConversionFcts.java    License: Apache License 2.0 6 votes vote down vote up
public static Function makeFromBlobFunction(final AbstractType<?> toType)
{
    final String name = "blobas" + toType.asCQL3Type();
    return new AbstractFunction(name, toType, BytesType.instance)
    {
        public ByteBuffer execute(List<ByteBuffer> parameters) throws InvalidRequestException
        {
            ByteBuffer val = parameters.get(0);
            try
            {
                if (val != null)
                    toType.validate(val);
                return val;
            }
            catch (MarshalException e)
            {
                throw new InvalidRequestException(String.format("In call to function %s, value 0x%s is not a valid binary representation for type %s",
                                                                name, ByteBufferUtil.bytesToHex(val), toType.asCQL3Type()));
            }
        }
    };
}
 
Example 16
Source Project: stratio-cassandra   Source File: Util.java    License: Apache License 2.0 5 votes vote down vote up
public static void addMutation(Mutation rm, String columnFamilyName, String superColumnName, long columnName, String value, long timestamp)
{
    CellName cname = superColumnName == null
                   ? CellNames.simpleDense(getBytes(columnName))
                   : CellNames.compositeDense(ByteBufferUtil.bytes(superColumnName), getBytes(columnName));
    rm.add(columnFamilyName, cname, ByteBufferUtil.bytes(value), timestamp);
}
 
Example 17
Source Project: emodb   Source File: RowKeyUtilsTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testRowKeyRawMin() {
    ByteBuffer rowKey = RowKeyUtils.getRowKeyRaw(0, 0, "");
    assertRowKeyLayout(rowKey, 0, 0, "");

    byte[] bytes = ByteBufferUtil.getArray(rowKey);
    assertEquals(bytes.length, 9);
    for (byte b : bytes) {
        assertEquals(b & 0xff, 0);
    }
}
 
Example 18
Source Project: stratio-cassandra   Source File: ReadResponse.java    License: Apache License 2.0 5 votes vote down vote up
public long serializedSize(ReadResponse response, int version)
{
    TypeSizes typeSizes = TypeSizes.NATIVE;
    ByteBuffer buffer = response.isDigestQuery() ? response.digest() : ByteBufferUtil.EMPTY_BYTE_BUFFER;
    int size = typeSizes.sizeof(buffer.remaining());
    size += buffer.remaining();
    size += typeSizes.sizeof(response.isDigestQuery());
    if (!response.isDigestQuery())
        size += Row.serializer.serializedSize(response.row(), version);
    return size;
}
 
Example 19
Source Project: emodb   Source File: AstyanaxBlockedDataReaderDAO.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Iterator<Change> readTimeline(Key key, boolean includeContentData, UUID start, UUID end, boolean reversed,
                                     long limit, ReadConsistency consistency) {
    checkNotNull(key, "key");
    checkArgument(limit > 0, "Limit must be >0");
    checkNotNull(consistency, "consistency");

    AstyanaxTable table = (AstyanaxTable) key.getTable();
    AstyanaxStorage storage = table.getReadStorage();
    DeltaPlacement placement = (DeltaPlacement) storage.getPlacement();
    ByteBuffer rowKey = storage.getRowKey(key.getKey());

    // Read Delta and Compaction objects
    Iterator<Change> deltas = Iterators.emptyIterator();
    if (includeContentData) {
        ColumnFamily<ByteBuffer, DeltaKey> cf = placement.getBlockedDeltaColumnFamily();
        DeltaKey deltaStart = start != null ? new DeltaKey(start, 0) : null;
        DeltaKey deltaEnd = end != null ? new DeltaKey(end, Integer.MAX_VALUE) : null;
        deltas = decodeDeltaColumns(new LimitCounter(limit).limit(new AstyanaxDeltaIterator(columnScan(rowKey, placement, cf, deltaStart, deltaEnd, reversed, _deltaKeyInc, Long.MAX_VALUE, 0, consistency), reversed, _deltaPrefixLength, ByteBufferUtil.bytesToHex((rowKey)))));

    }

    // Read History objects
    Iterator<Change> deltaHistory = Iterators.emptyIterator();
    ColumnFamily<ByteBuffer, UUID> deltaHistoryCf = placement.getDeltaHistoryColumnFamily();
    deltaHistory = decodeColumns(columnScan(rowKey, placement, deltaHistoryCf, start, end, reversed, _uuidInc, limit, 0, consistency));

    return touch(MergeIterator.merge(deltas, deltaHistory, reversed));
}
 
Example 20
Source Project: stratio-cassandra   Source File: CassandraServer.java    License: Apache License 2.0 5 votes vote down vote up
public List<ColumnOrSuperColumn> get_slice(ByteBuffer key, ColumnParent column_parent, SlicePredicate predicate, ConsistencyLevel consistency_level)
throws InvalidRequestException, UnavailableException, TimedOutException
{
    if (startSessionIfRequested())
    {
        Map<String, String> traceParameters = ImmutableMap.of("key", ByteBufferUtil.bytesToHex(key),
                                                              "column_parent", column_parent.toString(),
                                                              "predicate", predicate.toString(),
                                                              "consistency_level", consistency_level.name());
        Tracing.instance.begin("get_slice", traceParameters);
    }
    else
    {
        logger.debug("get_slice");
    }

    try
    {
        ClientState cState = state();
        String keyspace = cState.getKeyspace();
        state().hasColumnFamilyAccess(keyspace, column_parent.column_family, Permission.SELECT);
        return getSliceInternal(keyspace, key, column_parent, System.currentTimeMillis(), predicate, consistency_level, cState);
    }
    catch (RequestValidationException e)
    {
        throw ThriftConversion.toThrift(e);
    }
    finally
    {
        Tracing.instance.stopSession();
    }
}
 
Example 21
Source Project: Hive-Cassandra   Source File: CassandraPut.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void write(DataOutput out) throws IOException {
  out.writeInt(key.remaining());
  out.write(ByteBufferUtil.getArray(key));
  out.writeInt(1);
  out.writeInt(columns.size());
  for (CassandraColumn c: columns){
    c.write(out);
  }
}
 
Example 22
Source Project: stratio-cassandra   Source File: CompositeType.java    License: Apache License 2.0 5 votes vote down vote up
private static boolean readStatic(ByteBuffer bb)
{
    if (bb.remaining() < 2)
        return false;

    int header = ByteBufferUtil.getShortLength(bb, bb.position());
    if ((header & 0xFFFF) != STATIC_MARKER)
        return false;

    ByteBufferUtil.readShortLength(bb); // Skip header
    return true;
}
 
Example 23
public List<IMutation> getWriteData()
{
    List<IMutation> rms = new LinkedList<IMutation>();
    Mutation rm = new Mutation(keyspaceName, ByteBufferUtil.bytes("key1"));
    rm.addCounter(cfname, CellNames.simpleDense(ByteBufferUtil.bytes("Column1")), 42);
    rms.add(new CounterMutation(rm, ConsistencyLevel.ONE));
    return rms;
}
 
Example 24
Source Project: stratio-cassandra   Source File: RangeTombstoneTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void test7808_2() throws ExecutionException, InterruptedException, IOException
{
    Keyspace ks = Keyspace.open(KSNAME);
    ColumnFamilyStore cfs = ks.getColumnFamilyStore(CFNAME);
    cfs.metadata.gcGraceSeconds(2);

    String key = "7808_2";
    Mutation rm;
    rm = new Mutation(KSNAME, ByteBufferUtil.bytes(key));
    for (int i = 10; i < 20; i++)
        add(rm, i, 0);
    rm.apply();
    cfs.forceBlockingFlush();

    rm = new Mutation(KSNAME, ByteBufferUtil.bytes(key));
    ColumnFamily cf = rm.addOrGet(CFNAME);
    cf.delete(new DeletionInfo(0,0));
    rm.apply();

    rm = new Mutation(KSNAME, ByteBufferUtil.bytes(key));
    add(rm, 5, 1);
    rm.apply();

    cfs.forceBlockingFlush();
    Thread.sleep(5);
    cfs.forceMajorCompaction();
    assertEquals(1, Util.getColumnFamily(ks, Util.dk(key), CFNAME).getColumnCount());
}
 
Example 25
Source Project: stratio-cassandra   Source File: ByteBufferUtils.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Returns the specified {@link java.nio.ByteBuffer} as a byte array.
 *
 * @param byteBuffer a {@link java.nio.ByteBuffer} to be converted to a byte array.
 * @return the byte array representation of the {@code byteBuffer}.
 */
public static byte[] asArray(ByteBuffer byteBuffer) {
    ByteBuffer bb = ByteBufferUtil.clone(byteBuffer);
    byte[] bytes = new byte[bb.remaining()];
    bb.get(bytes);
    return bytes;
}
 
Example 26
Source Project: stratio-cassandra   Source File: CellTest.java    License: Apache License 2.0 5 votes vote down vote up
private Cell expiring(String name, String value, long timestamp, int expirationTime, boolean nativeCell)
{
    ExpiringCell cell = new BufferExpiringCell(Util.cellname(name), ByteBufferUtil.bytes(value), timestamp, 1, expirationTime);
    if (nativeCell)
        cell = new NativeExpiringCell(allocator, order.getCurrent(), cell);
    return cell;
}
 
Example 27
Source Project: stratio-cassandra   Source File: RecoveryManager2Test.java    License: Apache License 2.0 5 votes vote down vote up
private void insertRow(String cfname, String key) 
{
    ColumnFamily cf = ArrayBackedSortedColumns.factory.create("Keyspace1", cfname);
    cf.addColumn(column("col1", "val1", 1L));
    Mutation rm = new Mutation("Keyspace1", ByteBufferUtil.bytes(key), cf);
    rm.apply();
}
 
Example 28
Source Project: stratio-cassandra   Source File: IndexedSliceReader.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Sets the seek position to the start of the row for column scanning.
 */
private void setToRowStart(RowIndexEntry rowEntry, FileDataInput in) throws IOException
{
    if (in == null)
    {
        this.file = sstable.getFileDataInput(rowEntry.position);
    }
    else
    {
        this.file = in;
        in.seek(rowEntry.position);
    }
    sstable.partitioner.decorateKey(ByteBufferUtil.readWithShortLength(file));
}
 
Example 29
Source Project: stratio-cassandra   Source File: TimeUUIDType.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public ByteBuffer fromStringCQL2(String source) throws MarshalException
{
    // Return an empty ByteBuffer for an empty string.
    if (source.isEmpty())
        return ByteBufferUtil.EMPTY_BYTE_BUFFER;

    ByteBuffer idBytes = null;

    // ffffffff-ffff-ffff-ffff-ffffffffff
    if (regexPattern.matcher(source).matches())
    {
        UUID uuid = null;
        try
        {
            uuid = UUID.fromString(source);
            idBytes = decompose(uuid);
        }
        catch (IllegalArgumentException e)
        {
            throw new MarshalException(String.format("unable to make UUID from '%s'", source), e);
        }

        if (uuid.version() != 1)
            throw new MarshalException("TimeUUID supports only version 1 UUIDs");
    }
    else
    {
        idBytes = ByteBuffer.wrap(UUIDGen.getTimeUUIDBytes(TimestampSerializer.dateStringToTimestamp(source)));
    }

    return idBytes;
}
 
Example 30
@Override
public BigDecimal deserialize(ByteBuffer paramByteBuffer, ProtocolVersion paramProtocolVersion) throws InvalidTypeException {
	if (paramByteBuffer == null) {
		return null;

	}
	// always duplicate the ByteBuffer instance before consuming it!
	Long value = ByteBufferUtil.toLong(paramByteBuffer.duplicate());
	return new BigDecimal(value);
}