incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Ellis <jbel...@gmail.com>
Subject Re: ? how does one specify a supercolumn range?
Date Sat, 31 Jul 2010 03:30:50 GMT
the optional supercolumn in the columnparent struct is what determines
whether the columns you are slicing are supercolumns, or subcolumns of
a single supercolumn [the one in the parent struct].

On Wed, Jul 28, 2010 at 11:38 AM, james anderson <james.anderson@setf.de> wrote:
> if i have data of the form
>
> Keyspace1 ->
>  Super2 ->
>    icecream ->
>      20100701 ->   :vanille 100 :chocolade 2 :riesling-sorbet 900
>      20100702 ->   :vanille 100 :chocolade 200 :riesling-sorbet 100
>   cake
>      20100701 ->   :cheescake 2 :linzer 100 :apfel 2
>      20100702 ->   :cheescake 100 :linzer 10 :apfel 20
>
> i would like to get the columns for a range of supercolumns:
>
>   just the "vanille" entries for all dates
>   the vanille and the cheesecake entries for all dates.
>   alternatively, if the schema were such that all keys exhibit the same
> column structure, the "vanille" entries for all keys for all days?
>
> the examples, below illustrate each of the eight (key x supercolumn x
> column) variations for get-range-slice.
> they suggest that, if the column and supercolumn are both specified, the
> reults reflect that constraint.
> in the other cases - where the column appears but no supercolumn, no column
> is returned even though (more than) one is "present".
>
> what is the correct way to specify a supercolumn range?
>
> -------------------------------------------
>
> (CASSANDRA_2.1.0:GET-RANGE-SLICE
>  *ks* "Keyspace1"
>  (CASSANDRA_2.1.0:make-columnparent :column-family "Super2")
>  (CASSANDRA_2.1.0:make-slicepredicate :slice-range
> (CASSANDRA_2.1.0:make-slicerange :start "" :finish ""))
>  "" "" 100 1)
> ==>
> (****)
>
>
> ;;; (k- s- c+) => a keyslice for each key, but no supercolumns
> (CASSANDRA_2.1.0:GET-RANGE-SLICE
>  *ks* "Keyspace1"
>  (CASSANDRA_2.1.0:make-columnparent :column-family "Super2")
>  (CASSANDRA_2.1.0:make-slicepredicate :column-names '("VANILLE"))
>  "" "" 100 1)
> ==>
> (#<CASSANDRA_2.1.0:KEYSLICE  :KEY "icecream" :COLUMNS NIL {B587269}>
>  #<CASSANDRA_2.1.0:KEYSLICE  :KEY "cake" :COLUMNS NIL {B587351}>)
>
>
> ;;; (k- s+ c-) => a keyslice for each key, where the supercolumn is present,
> with its columns
> (CASSANDRA_2.1.0:GET-RANGE-SLICE
>  *ks* "Keyspace1"
>  (CASSANDRA_2.1.0:make-columnparent :column-family "Super2" :super-column
> "20100701")
>  (CASSANDRA_2.1.0:make-slicepredicate :slice-range
> (CASSANDRA_2.1.0:make-slicerange :start "" :finish ""))
>  "" "" 100 1)
> ==>
> (#<CASSANDRA_2.1.0:KEYSLICE
>  :KEY "icecream"
>  :COLUMNS (#<CASSANDRA_2.1.0:COLUMNORSUPERCOLUMN
>           :COLUMN #<CASSANDRA_2.1.0:COLUMN
>                    :NAME #(67 72 79 67 79 76 65 68 69)
>                    :VALUE #(50)
>                    :TIMESTAMP 134996243690000000 {B568641}> {B568621}>
>           #<CASSANDRA_2.1.0:COLUMNORSUPERCOLUMN
>           :COLUMN #<CASSANDRA_2.1.0:COLUMN
>                   :NAME #(82 73 69 83 76 73 78 71 45 83 79 82 66 69 84)
>                   :VALUE #(57 48 48)
>                   :TIMESTAMP 134996243690000000 {B5687D1}> {B5687B1}>
>           #<CASSANDRA_2.1.0:COLUMNORSUPERCOLUMN
>           :COLUMN #<CASSANDRA_2.1.0:COLUMN
>                   :NAME #(86 65 78 73 76 76 69)
>                   :VALUE #(49 48 48)
>                   :TIMESTAMP 134996243690000000 {B568961}> {B568941}>)
>  {B568541}>
>  #<CASSANDRA_2.1.0:KEYSLICE
>  :KEY "cake"
>  :COLUMNS (#<CASSANDRA_2.1.0:COLUMNORSUPERCOLUMN
>           :COLUMN #<CASSANDRA_2.1.0:COLUMN
>                   :NAME #(65 80 70 69 76)
>                   :VALUE #(50)
>                   :TIMESTAMP 134996244070000000 {B568BA1}> {B568B81}>
>           #<CASSANDRA_2.1.0:COLUMNORSUPERCOLUMN
>           :COLUMN #<CASSANDRA_2.1.0:COLUMN
>                   :NAME #(67 72 69 69 83 67 65 75 69)
>                   :VALUE #(50)
>                   :TIMESTAMP 134996244070000000 {B568D29}> {B568D09}>
>           #<CASSANDRA_2.1.0:COLUMNORSUPERCOLUMN
>           :COLUMN #<CASSANDRA_2.1.0:COLUMN
>                   :NAME #(76 73 78 90 69 82)
>                   :VALUE #(49 48 48)
>                   :TIMESTAMP 134996244070000000 {B568EB9}> {B568E99}>)
> {B568AD1}>)
>
>
> ;;; (k- s+ c+) => a keyslice for each key, with the column if it is present
> for the supercolumn
> (CASSANDRA_2.1.0:GET-RANGE-SLICE
>  *ks* "Keyspace1"
>  (CASSANDRA_2.1.0:make-columnparent :column-family "Super2" :super-column
> "20100701")
>  (CASSANDRA_2.1.0:make-slicepredicate :column-names '("VANILLE"))
>  "" "" 100 1)
> ==>
> (#<CASSANDRA_2.1.0:KEYSLICE
>    :KEY "icecream"
>    :COLUMNS (#<CASSANDRA_2.1.0:COLUMNORSUPERCOLUMN
>              :COLUMN #<CASSANDRA_2.1.0:COLUMN
>                      :NAME #(86 65 78 73 76 76 69)
>                      :VALUE #(49 48 48)
>                      :TIMESTAMP 134996243690000000 {B56EE21}> {B56EE01}>)
> {B56ED21}>
>  #<CASSANDRA_2.1.0:KEYSLICE  :KEY "cake" :COLUMNS NIL {B56EF91}>)
>
>
> ;;; (k+ s- c-) => everything for the given key - supercolumns and nested
> columns
> (CASSANDRA_2.1.0:GET-RANGE-SLICE
>  *ks* "Keyspace1"
>  (CASSANDRA_2.1.0:make-columnparent :column-family "Super2")
>  (CASSANDRA_2.1.0:make-slicepredicate :slice-range
> (CASSANDRA_2.1.0:make-slicerange :start "" :finish ""))
>  "icecream" "icecream" 100 1)
> ==>
> (**** for "icecream")
>
>
> ;;; (k+ s- c+) => a single keyslice, with no columns
> (CASSANDRA_2.1.0:GET-RANGE-SLICE
>  *ks* "Keyspace1"
>  (CASSANDRA_2.1.0:make-columnparent :column-family "Super2")
>  (CASSANDRA_2.1.0:make-slicepredicate :column-names '("VANILLE"))
>  "icecream" "icecream" 100 1)
> ==>
> (#<CASSANDRA_2.1.0:KEYSLICE  :KEY "icecream" :COLUMNS NIL {B59F1D9}>)
>
>
> ;;; (k+ s+ c-) => a single keyslice, with all columns
> (CASSANDRA_2.1.0:GET-RANGE-SLICE
>  *ks* "Keyspace1"
>  (CASSANDRA_2.1.0:make-columnparent :column-family "Super2" :super-column
> "20100701")
>  (CASSANDRA_2.1.0:make-slicepredicate :slice-range
> (CASSANDRA_2.1.0:make-slicerange :start "" :finish ""))
>  "icecream" "icecream" 100 1)
> ==>
> (#<CASSANDRA_2.1.0:KEYSLICE
>  :KEY "icecream"
>  :COLUMNS (#<CASSANDRA_2.1.0:COLUMNORSUPERCOLUMN
>           :COLUMN #<CASSANDRA_2.1.0:COLUMN
>                   :NAME #(67 72 79 67 79 76 65 68 69)
>                   :VALUE #(50)
>                   :TIMESTAMP 134996243690000000 {B5ABBE9}> {B5ABBC9}>
>           #<CASSANDRA_2.1.0:COLUMNORSUPERCOLUMN
>           :COLUMN #<CASSANDRA_2.1.0:COLUMN
>                   :NAME #(82 73 69 83 76 73 78 71 45 83 79 82 66 69 84)
>                   :VALUE #(57 48 48)
>                   :TIMESTAMP 134996243690000000 {B5ABD79}> {B5ABD59}>
>           #<CASSANDRA_2.1.0:COLUMNORSUPERCOLUMN
>           :COLUMN #<CASSANDRA_2.1.0:COLUMN
>                   :NAME #(86 65 78 73 76 76 69)
>                   :VALUE #(49 48 48)
>                   :TIMESTAMP 134996243690000000 {B5ABF09}> {B5ABEE9}>)
> {B5ABAE9}>)
>
>
> ;;; (k+ s+ c+) => a single key slice with the single column for the single
> supercolumn
> (CASSANDRA_2.1.0:GET-RANGE-SLICE
>  *ks* "Keyspace1"
>  (CASSANDRA_2.1.0:make-columnparent :column-family "Super2" :super-column
> "20100701")
>  (CASSANDRA_2.1.0:make-slicepredicate :column-names '("VANILLE"))
>  "icecream" "icecream" 100 1)
> ==>
> (#<CASSANDRA_2.1.0:KEYSLICE
>  :KEY "icecream"
>  :COLUMNS (#<CASSANDRA_2.1.0:COLUMNORSUPERCOLUMN
>           :COLUMN #<CASSANDRA_2.1.0:COLUMN
>                   :NAME #(86 65 78 73 76 76 69)
>                   :VALUE #(49 48 48)
>                   :TIMESTAMP 134996243690000000 {B5B0301}> {B5B02E1}>)
> {B5B0201}>)
>



-- 
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of Riptano, the source for professional Cassandra support
http://riptano.com

Mime
View raw message