Re: JSON Order By

2015-10-02 Thread Tyler Hobbs
On Thu, Oct 1, 2015 at 9:11 AM, Ashish Soni  wrote:

> I have a below structure stored in cassandra and i would like to get the
> internal array sorted by a property when i select it , Please let me know
> if there is way to do that .
>
> I need to sort the rules Array by property ruleOrder when i select
>

Unfortunately, that's not possible. Cassandra can only order result rows by
the clustering columns.  The new JSON functionality doesn't change this, it
just adds a new input/output format.  You'll need to sort the results
client-side.


-- 
Tyler Hobbs
DataStax 


JSON Order By

2015-10-01 Thread Ashish Soni
Hi All ,
I have a question related to JSON sorting
I have a below structure stored in cassandra and i would like to get the
internal array sorted by a property when i select it , Please let me know
if there is way to do that .

I need to sort the rules Array by property ruleOrder when i select

CREATE TYPE IF NOT EXISTS Rule (  condition text,  action text,  ruleOrder
int);

INSERT INTO model.RuleSetSchedule JSON ' {
ruleSetName": "RATES",
"ruleSetId": "829aa84b-4bba-411f-a4fb-38167a987cda",
"scheduleId":1,
"effectiveStartDate": "2015-02-01 00:00:00",
"effectiveEndDate": "2015-03-01 00:00:00",
"rules": {
"1": {
"condition": "BoardStation ==''Lowell''",
"action": "FareAmount=9.25",
   * "ruleOrder": 2*
}
 "2": {
"condition": "BoardStation ==''Lowell''",
"action": "FareAmount=9.25",
   * "ruleOrder": 1*
}

}
}';