incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hiller, Dean" <Dean.Hil...@nrel.gov>
Subject Re: Unable to prefix in astyanax read query
Date Tue, 02 Apr 2013 12:37:57 GMT
We ran into some similar errors in playorm development.  Basically, you
defined a composite probably but are not correctly using that composite.
I am not sure about queries though as we had the issue when saving data
(ie. Using deviceID+deviceName did not work and we had to create an full
blown composite object).  I think you need to read up on how astyanax
works with compositesŠ..I am not sure this is a cassandra question
reallyŠ.more of an astyanax one.

Dean

On 4/1/13 11:48 PM, "Apurva Jalit" <apurva.jalit@gmail.com> wrote:

>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