incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anthony Ikeda <anthony.ikeda....@gmail.com>
Subject Re: Limiting ColumnSlice range in second composite value
Date Fri, 02 Sep 2011 22:54:00 GMT
This is what I'm trying to do:

Sample of the data:
RowKey: localhost
=> (column=e3f3c900-d5b0-11e0-aa6b-005056c00008:ACTIVE, value=<?xml
version="1.0" encoding="UTF-8" standalone="yes"?>,
timestamp=1315001665761000)
=> (column=e4515250-d5b0-11e0-aa6b-005056c00008:INACTIVE, value=<?xml
version="1.0" encoding="UTF-8" standalone="yes"?>,
timestamp=1315001654271000)
=> (column=e45549f0-d5b0-11e0-aa6b-005056c00008:INACTIVE, value=<?xml
version="1.0" encoding="UTF-8" standalone="yes"?>,
timestamp=1315001654327000)
=> (column=e45cc400-d5b0-11e0-aa6b-005056c00008:INACTIVE, value=<?xml
version="1.0" encoding="UTF-8" standalone="yes"?>,
timestamp=1315001654355000)
=> (column=e462de80-d5b0-11e0-aa6b-005056c00008:INACTIVE, value=<?xml
version="1.0" encoding="UTF-8" standalone="yes"?>,
timestamp=1315001654394000)


I'll be activating and deactivating the inactive profiles in a chronological
order.


   - So I want to first retrieve current "ACTIVE" record (easy cause it's
   cached)
   - Put it to use and when ready, recreate the column - same timeUUID but
   "EXHAUSTED" status (delete then add)
   - Next I have to fetch the first "INACTIVE" column after this, delete
   that and re-create the record with an "ACTIVE" composite (same timeuuid,
   again add then delete) and repeat the process.


The second part of my composite is an ENUM of String literals:
Status.ACTIVE, Status.INACTIVE, Status.EXHAUSTED

I want to get the current row key of value (startTimeUUID, "ACTIVE") which
should only be one column (provided the code works)

All earlier columns are (timeUUID, "EXHAUSTED"), all later columns should be
(timeUUID, "INACTIVE")

I'm thinking to find the column that is "ACTIVE" I would set the range:

startComp = new Composite(timeUUID, "ACTIVE");
endComp = new Composite(timeUUID, ""ACTIVE_");

query.setRange(startComp, endComp, false, 2); //Fetch 2 just in case

To get all "INACTIVE" columns I'd use
startComp = new Composite(timeUUID, "INACTIVE");
endComp = new Composite(timeUUID, ""INACTIVE_");

query.setRange(startComp, endComp, false, 10);

Thing is I'm getting back all columns regardless of what I set for the
second half of the composite. Is what I'm trying to do possible?

Anthony


On Fri, Sep 2, 2011 at 12:29 PM, Nate McCall <nate@datastax.com> wrote:

> Instead of empty strings, try Character.[MAX|MIN-]_VALUE.
>
> On Thu, Sep 1, 2011 at 8:27 PM, Anthony Ikeda
> <anthony.ikeda.dev@gmail.com> wrote:
> > My Column name is of Composite(TimeUUIDType, UTF8Type) and I can query
> > across the TimeUUIDs correctly, but now I want to also range across the
> UTF8
> > component. Is this possible?
> >
> > UUID start = uuidForDate(new Date(1979, 1, 1));
> >
> > UUID end = uuidForDate(new Date(Long.MAX_VALUE));
> >
> > String startState = "";
> >
> > String endState = "";
> >
> > if (desiredState != null) {
> >
> >     mLog.debug("Restricting state to [" + desiredState.getValue() + "]");
> >
> >     startState = desiredState.getValue();
> >
> >     endState = desiredState.getValue().concat("_");
> >
> > }
> >
> >
> >
> > Composite startComp = new Composite(start, startState);
> >
> > Composite endComp = new Composite(end, endState);
> >
> > query.setRange(startComp, endComp, true, count);
> >
> > So far I'm not seeing any effect setting my "endState" String value.
> >
> > Anthony
>

Mime
View raw message