On Mon, Oct 3, 2011 at 12:02 PM, Alexandru Sicoe <adsicoe@gmail.com> wrote:
> Hi,
> I am using Cassandra 0.8.5, Hector 0.8.0-2 and cqlsh (cql 1.0.3). If I
> define a CF with comparator LongType like this:
>
> BasicColumnFamilyDefinition columnFamilyDefinition = new
> BasicColumnFamilyDefinition();
> columnFamilyDefinition.setKeyspaceName("XXX");
> columnFamilyDefinition.setName("YYY");
> columnFamilyDefinition.setDefaultValidationClass(_BYTESTYPE);
> columnFamilyDefinition.setMemtableOperationsInMillions(0.1);
> columnFamilyDefinition.setMemtableThroughputInMb(40);
> columnFamilyDefinition.setComparatorType(ComparatorType.LONGTYPE);
> try {
> cluster.addColumnFamily(new
> ThriftCfDef(columnFamilyDefinition));
> } catch(HectorException e) {
> throw e;
> }
>
> Then I put some data in the CF.
>
> The I try to do the following queries in cqlsh:
>
> use XXX;
> select * from YYY where KEY='aaa';
>
> nothing is returned!
>
> If I however do:
> select * from YYY;
>
> all the results are returned propperly!
>
> So I have 2 questios:
> 1) Can I read with CQL if CFs were defined using the basic API? (the fact
> that select * from YYY; works suggests that this is possible)
> 2) If yes, what is the correct query to use to read data with CQL? (I
> suspect KEY is wrong...is there a default?)
I suspect that you did not select a key validation class, and ended up
with a default of BytesType. CQL requires that your terms be hex
encoded when using BytesType.
--
Eric Evans
Acunu | http://www.acunu.com | @acunu
|