incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Evans <eev...@rackspace.com>
Subject Re: Two dimensional matrices
Date Tue, 13 Apr 2010 01:26:17 GMT
On Tue, 2010-04-13 at 00:45 +0200, Philippe wrote:
>         > However, you are also saying there is no way to also take
>         into account
>         > the "timeFrame" supercolumn in the same API call ? IE, it is
>         not
>         > possible to get back a data structure keyed by
>         > 'key,supercolumn,column' hence y,x and timeframe which I can
>         then
>         > process to my heart's delight ?
>         
>         
>         If you're talking about constructing predicates to slice on
>         both time
>         *and* X coordinate, then no. You can omit the super column
>         name from the
>         ColumnParent and return a slice of super columns (by time
>         period)
>         complete with all contained sub-columns, but you can't have it
>         both
>         ways, no.
> Eric, I'm trying to get my head around this...
> 
> 
> If I "omit the super column name" and do the query as you mentionned
> in your previous email, then you are saying it will return all columns
> corresponding to the column range of all super columns corresponding
> to the key range.
> This means it is possible to get a rectangular slice of the grid AND
> to get the "third dimension" which is time in my case, the only catch
> being that I cannot limit the amount of data retrieved in the 3rd
> dimension (timeframe).
> 
> 
> Is this correct ?

No, what I mean is that you can perform a slice that returns either
sub-columns, or super columns. In the former, the column names you are
slicing on are the sub-columns (X coords), in the latter it is super
columns (time). So:

On X coords, (same as my previous mail).

get_range_slice(
    keyspaceName,
    ColumnParent(CFname, timeFrame),
    SlicePredicate(
        slice_range=SliceRange(xstart, xend, false, colCount)
    ),
    ystart,
    yend,
    rowCount,
    consistencyLevel,
)

The "columns" attribute of the KeySlice structs returned will contain
the sub-columns contained in timeFrame that match your predicate.

On time.

get_range_slice(
    keyspaceName,
    ColumnParent(CFname, null),
    SlicePredicate(
        slice_range=SliceRange(timeStart, timeEnd, false, colCount)
    ),
    ystart,
    yend,
    rowCount,
    consistencyLevel,
)

The "columns" attribute of the KeySlice structs returned will contain
the super columns that match the predicate. Each of these super columns
will contain *all* of the sub-columns.

-- 
Eric Evans
eevans@rackspace.com


Mime
View raw message