I found the solution, here it is if someone needs it:
        CellNameType cellComparator = columnFamily.getComparator();
        int clusteringPrefixSize = cellComparator.clusteringPrefixSize();

        for (int prefixNb = 0; prefixNb < clusteringPrefixSize; prefixNb++) {
            AbstractType<?> subtype = cellComparator.subtype(prefixNb);
            ByteBuffer clusteringKeyBytes = cell.name().get(prefixNb);
            String value = subtype.getString(clusteringKeyBytes);
            ...
        }

--
Jacques-Henri Berthemet

-----Original Message-----
From: Jacques-Henri Berthemet [mailto:jacques-henri.berthe...@genesys.com] 
Sent: vendredi 7 novembre 2014 19:14
To: dev@cassandra.apache.org
Subject: Retrieving clustering columns values from cell names

Hi Cassandra developers,

I'm implementing a custom PerRowSecondaryIndex and I managed to extract all 
data I need but clustering columns values from cell names. I know that they are 
part of the cell name itself and it's easy to extract the CQL column name:

    public static String cellNameToString(CFMetaData metadata, Cell cell) 
throws CharacterCodingException {
        if (metadata.isCQL3Table()) {
            return 
ByteBufferUtil.string(cell.name().cql3ColumnName(metadata).bytes);

But I don't understand how to extract the clustering column values from cell's 
name. Could someone share some info about that?

Thank you,
--
Jacques-Henri Berthemet



Reply via email to