Re: Limiting ColumnSlice range in second composite value

2011-09-02 Thread Nate McCall
Instead of empty strings, try Character.[MAX|MIN-]_VALUE.

On Thu, Sep 1, 2011 at 8:27 PM, Anthony Ikeda
anthony.ikeda@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


Re: Limiting ColumnSlice range in second composite value

2011-09-02 Thread Anthony Ikeda
This is what I'm trying to do:

Sample of the data:
RowKey: localhost
= (column=e3f3c900-d5b0-11e0-aa6b-005056c8:ACTIVE, value=?xml
version=1.0 encoding=UTF-8 standalone=yes?,
timestamp=1315001665761000)
= (column=e4515250-d5b0-11e0-aa6b-005056c8:INACTIVE, value=?xml
version=1.0 encoding=UTF-8 standalone=yes?,
timestamp=1315001654271000)
= (column=e45549f0-d5b0-11e0-aa6b-005056c8:INACTIVE, value=?xml
version=1.0 encoding=UTF-8 standalone=yes?,
timestamp=1315001654327000)
= (column=e45cc400-d5b0-11e0-aa6b-005056c8:INACTIVE, value=?xml
version=1.0 encoding=UTF-8 standalone=yes?,
timestamp=1315001654355000)
= (column=e462de80-d5b0-11e0-aa6b-005056c8: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 n...@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@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



Re: Limiting ColumnSlice range in second composite value

2011-09-02 Thread Anthony Ikeda
Okay, I reversed the composite and seem to have come up with a solution.
Although the rows are sorted by the status, the statuses are sorted
temporally which helps. I tell you this type of modeling really breaks the
rules :)

Anthony


On Fri, Sep 2, 2011 at 3:54 PM, Anthony Ikeda
anthony.ikeda@gmail.comwrote:

 This is what I'm trying to do:

 Sample of the data:
 RowKey: localhost
 = (column=e3f3c900-d5b0-11e0-aa6b-005056c8:ACTIVE, value=?xml
 version=1.0 encoding=UTF-8 standalone=yes?,
 timestamp=1315001665761000)
 = (column=e4515250-d5b0-11e0-aa6b-005056c8:INACTIVE, value=?xml
 version=1.0 encoding=UTF-8 standalone=yes?,
 timestamp=1315001654271000)
 = (column=e45549f0-d5b0-11e0-aa6b-005056c8:INACTIVE, value=?xml
 version=1.0 encoding=UTF-8 standalone=yes?,
 timestamp=1315001654327000)
 = (column=e45cc400-d5b0-11e0-aa6b-005056c8:INACTIVE, value=?xml
 version=1.0 encoding=UTF-8 standalone=yes?,
 timestamp=1315001654355000)
 = (column=e462de80-d5b0-11e0-aa6b-005056c8: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 n...@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@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