incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apurva Jalit <apurva.ja...@gmail.com>
Subject Unable to prefix in astyanax read query
Date Tue, 02 Apr 2013 05:48:55 GMT
I have a scheme as follows:

 TimeStamp
 Device ID
 Device Name
 Device Owner
 Device location

I have created this column family using CQL and defined the primary key as 
(TimeStamp,Device ID, Device Name). Through a serializable object that has 
fields for DeviceID, name and a field name (which stores either Device Owner or 
Device Location). I have inserted some records using Astyanax.

As per my understanding, the columns for a row are created by combining Device 
ID, Device Name and field name as column name and the value to be the value for 
that particular field. Thus for a particular timestamp and device, the column 
names would be in the pattern (Device ID:Device Name: ...).

So I believe we can use these 2 fields as prefix to obtain all the entries for a 
particular time-device combination.

I am using the following query to obtain the results:

  RowSliceQuery<String, ApBaseData> query = adu.keyspace
  .prepareQuery(columnFamily)
  .getKeySlice(timeStamp)
  .withColumnRange(new RangeBuilder()
   .setStart(deviceID+deviceName+"_\u00000")
   .setEnd(deviceID+deviceName+"_\uffff")
   .setLimit(batch_size)
   .build());

But on executing the above query I get the following Exception:

BadRequestException: [host=localhost(127.0.0.1):9160, latency=6(6), 
attempts=1]InvalidRequestException(why:Not enough bytes to read value of 
component 0)

Can any one help to understand where am I going wrong?



Mime
View raw message