Thanks Richard.
You are right. I missed that in key validation class.

-----Original Message-----
From: Richard Low [mailto:r...@acunu.com]
Sent: Tuesday, June 21, 2011 12:44 PM
To: user@cassandra.apache.org
Subject: Re: issue with querying SuperColumn

You have key validation class UTF8Type for the standard CF, but BytesType for 
the super.  This is why the key is "1" for standard, but printed as "31" for 
super, which is the hex ascii code for 1.  In your java code, use 
"1".getBytes() as your key and it should work.

Richard.

--
Richard Low
Acunu | http://www.acunu.com | @acunu

On Tue, Jun 21, 2011 at 7:36 AM, Vivek Mishra <vivek.mis...@impetus.co.in> 
wrote:
>
>
>
>
> I am facing one issue with querying superColumn using clien.get() API.
> Although it is working when I try it for a ColumnFamily(rather than
> SuperColumnFamily).
>
>
>
> It is working for:
>
>     ColumnFamily: users
>
>       Key Validation Class: org.apache.cassandra.db.marshal.UTF8Type
>
>       Default column value validator:
> org.apache.cassandra.db.marshal.BytesType
>
>       Columns sorted by: org.apache.cassandra.db.marshal.UTF8Type
>
>       Row cache size / save period in seconds: 0.0/0
>
>       Key cache size / save period in seconds: 200000.0/14400
>
>       Memtable thresholds: 0.2953125/63/1440 (millions of
> ops/MB/minutes)
>
>      GC grace seconds: 864000
>
>       Compaction min/max thresholds: 4/32
>
>       Read repair chance: 1.0
>
>       Replicate on write: false
>
>       Built indexes: []
>
>
>
> Issuing list of users(using Cassandra-cli):
>
>
>
> [default@key1] list users;
>
> Using default limit of 100
>
> -------------------
>
> RowKey: 1
>
> => (column=name, value=74657374, timestamp=1308637325517000)
>
>
>
>
>
> Java code:
>
> String key="1";
>
>             ColumnPath columnPath = new ColumnPath("users");
>
>             columnPath.setColumn("name".getBytes());
>
>             ColumnOrSuperColumn colName =
> cassndraClient.get(java.nio.ByteBuffer.wrap(key.getBytes()),
> columnPath , ConsistencyLevel.ONE);
>
>             Column col = colName.getColumn();
>
>             System.out.println(new String(col.getValue(), "UTF-8"));
>
>
>
>
>
> RESULT: I am getting “test” printed.
>
>
>
> BUT when I tried it for Super column family “SuperCli” :
>
>
>
>     ColumnFamily: SuperCli (Super)
>
>       Key Validation Class: org.apache.cassandra.db.marshal.BytesType
>
>       Default column value validator:
> org.apache.cassandra.db.marshal.BytesType
>
>       Columns sorted by:
> org.apache.cassandra.db.marshal.UTF8Type/org.apache.cassandra.db.marsh
> al.UTF8Type
>
>       Row cache size / save period in seconds: 0.0/0
>
>       Key cache size / save period in seconds: 200000.0/14400
>
>       Memtable thresholds: 0.2953125/63/1440 (millions of
> ops/MB/minutes)
>
>       GC grace seconds: 864000
>
>       Compaction min/max thresholds: 4/32
>
>       Read repair chance: 1.0
>
>       Replicate on write: false
>
>       Built indexes: []
>
>
>
> [default@key1] list SuperCli;
>
> Using default limit of 100
>
> -------------------
>
> RowKey: 31
>
> => (super_column=address,
>
>      (column=city, value=6e6f696461, timestamp=1308296234977000))
>
> => (super_column=address1,
>
>      (column=city, value=476e6f696461, timestamp=1308296283221000))
>
> => (super_column=address2,
>
>      (column=city, value=476e6f696461, timestamp=1308296401951000))
>
>
>
> 1 Row Returned.
>
>
>
>
>
> Java Code:
>
>
>
> ColumnPath columnPath = new ColumnPath("SuperCli");
>
>             columnPath.setSuper_column("address".getBytes());
>
>             String key="31";
>
>
> cassndraClient.get(java.nio.ByteBuffer.wrap(key.getBytes()),
> columnPath , ConsistencyLevel.ONE);
>
>
>
>
>
> I am getting exception:
>
>
>
> NotFoundException()
>
>      at
> org.apache.cassandra.thrift.Cassandra$get_result.read(Cassandra.java:6
> 418)
>
>      at
> org.apache.cassandra.thrift.Cassandra$Client.recv_get(Cassandra.java:5
> 19)
>
>      at
> org.apache.cassandra.thrift.Cassandra$Client.get(Cassandra.java:492)
>
>      at CasQuery.main(CasQuery.java:112)
>
>
>
>
>
>
>
>
>
> Any idea about this issue?
>
>
>
>
>
> --Vivek
>
> ________________________________
> Write to us for a Free Gold Pass to the Cloud Computing Expo, NYC to
> attend a live session by Head of Impetus Labs on ‘Secrets of Building
> a Cloud Vendor Agnostic PetaByte Scale Real-time Secure Web
> Application on the Cloud ‘.
>
> Looking to leverage the Cloud for your Big Data Strategy ? Attend
> Impetus webinar on May 27 by registering at
> http://www.impetus.com/webinar?eventid=42 .
>
>
> NOTE: This message may contain information that is confidential,
> proprietary, privileged or otherwise protected by law. The message is
> intended solely for the named addressee. If received in error, please
> destroy and notify the sender. Any use of this email is prohibited
> when received in error. Impetus does not represent, warrant and/or
> guarantee, that the integrity of this communication has been
> maintained nor that the communication is free of errors, virus, interception 
> or interference.
>

________________________________

Write to us for a Free Gold Pass to the Cloud Computing Expo, NYC to attend a 
live session by Head of Impetus Labs on ‘Secrets of Building a Cloud Vendor 
Agnostic PetaByte Scale Real-time Secure Web Application on the Cloud ‘.

Looking to leverage the Cloud for your Big Data Strategy ? Attend Impetus 
webinar on May 27 by registering at http://www.impetus.com/webinar?eventid=42 .


NOTE: This message may contain information that is confidential, proprietary, 
privileged or otherwise protected by law. The message is intended solely for 
the named addressee. If received in error, please destroy and notify the 
sender. Any use of this email is prohibited when received in error. Impetus 
does not represent, warrant and/or guarantee, that the integrity of this 
communication has been maintained nor that the communication is free of errors, 
virus, interception or interference.

Reply via email to