You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cassandra.apache.org by Jacques-Henri Berthemet <ja...@genesys.com> on 2014/11/07 19:13:33 UTC
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
Re: CQLSH is not connecting - Trunk Version
Posted by Aleksey Yeschenko <al...@apache.org>.
First, no, it does not by default connect to the thrift service port - it does use 9042 by default.
You most likely have the port overridden in ~/.cassandra/cqlshrc, set to 9160.
Secondly, this is not a question for dev@ - this belongs to the users mailing list.
Thanks.
--
AY
On November 11, 2014 at 5:53:04 PM, Rajanarayanan Thottuvaikkatumana (rnamboodiri@gmail.com) wrote:
If I give the explicit host address and port number, it connects. So by default it takes the thrift service port and in my opinion that is not a correct behavior.
Rajanarayanans-MacBook-Pro:cassandra-trunk RajT$ ./bin/cqlsh 127.0.0.1 9042
Connected to Test Cluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 3.0.0-SNAPSHOT | CQL spec 3.2.0 | Native protocol v3]
Use HELP for help.
cqlsh>
Thanks
-Raj
On 11-Nov-2014, at 2:46 pm, Rajanarayanan Thottuvaikkatumana <rn...@gmail.com> wrote:
> In the trunk version of the code base with the latest code, the cqlsh is not connecting. Here is the message I am getting.
>
> Rajanarayanans-MacBook-Pro:cassandra-trunk RajT$ ./bin/cqlsh
> Connection error: ('Unable to connect to any servers', {'127.0.0.1': ConnectionShutdown('Connection <AsyncoreConnection(4405206416) 127.0.0.1:9160 (closed)> is already closed',)})
>
> I have done restarting to make sure that there is no clash with the port number and stuff like that. The server has started without any exceptions.
>
> Any idea?
>
> Thanks
> -Raj
Re: CQLSH is not connecting - Trunk Version
Posted by Rajanarayanan Thottuvaikkatumana <rn...@gmail.com>.
If I give the explicit host address and port number, it connects. So by default it takes the thrift service port and in my opinion that is not a correct behavior.
Rajanarayanans-MacBook-Pro:cassandra-trunk RajT$ ./bin/cqlsh 127.0.0.1 9042
Connected to Test Cluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 3.0.0-SNAPSHOT | CQL spec 3.2.0 | Native protocol v3]
Use HELP for help.
cqlsh>
Thanks
-Raj
On 11-Nov-2014, at 2:46 pm, Rajanarayanan Thottuvaikkatumana <rn...@gmail.com> wrote:
> In the trunk version of the code base with the latest code, the cqlsh is not connecting. Here is the message I am getting.
>
> Rajanarayanans-MacBook-Pro:cassandra-trunk RajT$ ./bin/cqlsh
> Connection error: ('Unable to connect to any servers', {'127.0.0.1': ConnectionShutdown('Connection <AsyncoreConnection(4405206416) 127.0.0.1:9160 (closed)> is already closed',)})
>
> I have done restarting to make sure that there is no clash with the port number and stuff like that. The server has started without any exceptions.
>
> Any idea?
>
> Thanks
> -Raj
CQLSH is not connecting - Trunk Version
Posted by Rajanarayanan Thottuvaikkatumana <rn...@gmail.com>.
In the trunk version of the code base with the latest code, the cqlsh is not connecting. Here is the message I am getting.
Rajanarayanans-MacBook-Pro:cassandra-trunk RajT$ ./bin/cqlsh
Connection error: ('Unable to connect to any servers', {'127.0.0.1': ConnectionShutdown('Connection <AsyncoreConnection(4405206416) 127.0.0.1:9160 (closed)> is already closed',)})
I have done restarting to make sure that there is no clash with the port number and stuff like that. The server has started without any exceptions.
Any idea?
Thanks
-Raj
RE: Retrieving clustering columns values from cell names
Posted by Jacques-Henri Berthemet <ja...@genesys.com>.
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.berthemet@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