incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aditya Narayan <ady...@gmail.com>
Subject Concatenating ids with extension to keep multiple rows related to an entity in a single CF
Date Thu, 03 Nov 2011 20:48:26 GMT
I am concatenating  two Integer ids through bitwise operations(as described
below) to create a single primary key of type long. I wanted to know if
this is a good practice. This would help me in keeping multiple rows of an
entity in a single column family by appending different extensions to the
entityId.
Are there better ways ? My Ids are of type Integer(4 bytes).


    public static final long makeCompositeKey(int k1, int k2){
        return (long)k1 << 32 | k2;
    }

Mime
View raw message