You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Colin Yates <co...@gmail.com> on 2010/04/12 16:48:29 UTC

(another) Newbie question

Hi,

Assume I have:

SCF: Projects : {
   CF:"project1": { 
         20100101: {cost:10, other columns},
         20100102: {cost:10, other columns},
         .....
         20100120: {cost 10, other columns}
   },
   CF:"project2": { 
         20100105: {cost:12, other columns}
         .....
         20100115: {cost 12, other columns}
  }
}

I know want to display the cost of a project for 2010107-2010109 
where the cost is the average of cost in the snapshot 
(i.e. project1: (3*10/3), project2: (3**12/3)).

I was hoping I could do a get_range_slices specifying 'project*' for the 
columnFamily and a keyRange start: 20100107, end:20100109 but I 
get an error 'InvalidRequestException(why:unconfigured columnfamily project*)'.

This is related to my other post 
(http://permalink.gmane.org/gmane.comp.db.cassandra.user/4003) 
but is the right to do here to have a separate 'snapshots' SCF with 
a key of the snapshot date and the value a CF of projectIds?

Many thanks,

Col


Re: (another) Newbie question

Posted by Jonathan Ellis <jb...@gmail.com>.
The important distinction here is that you can slice on columns in a
row, but you can't slice on column family (or keyspace) names, because
the data isn't stored contiguously.  The row, within the columnfamily,
is the unit of data storage and api focus.

On Sat, Apr 17, 2010 at 12:42 AM, Benjamin Black <b...@b3k.us> wrote:
> The multi-level dictionary explanation holds.  Regex on keys like that
> is something specific language implementations support, not something
> inherent in a dictionary data structure.  The table model is
> particularly fraught because it drags in a lot of relational
> assumptions, none of which hold.  And I am not suggesting renaming
> anything :)
>
>
> b
>
> On Fri, Apr 16, 2010 at 3:08 PM, Jonathan Ellis <jb...@gmail.com> wrote:
>> On Mon, Apr 12, 2010 at 9:48 AM, Colin Yates <co...@gmail.com> wrote:
>>> I was hoping I could do a get_range_slices specifying 'project*' for the
>>> columnFamily and a keyRange start: 20100107, end:20100109 but I
>>> get an error 'InvalidRequestException(why:unconfigured columnfamily project*)'.
>>
>> I think you've been misled by the "think of Cassandra as a multi-level
>> hash" explanations; you can't wildcard ColumnFamilies like that.  (I
>> personally think that the model of "a columnfamily is like a table,
>> except that its rows can contain nested columns [supercolumns]" is
>> more useful.)
>>
>> -Jonathan
>>
>

Re: (another) Newbie question

Posted by Benjamin Black <b...@b3k.us>.
The multi-level dictionary explanation holds.  Regex on keys like that
is something specific language implementations support, not something
inherent in a dictionary data structure.  The table model is
particularly fraught because it drags in a lot of relational
assumptions, none of which hold.  And I am not suggesting renaming
anything :)


b

On Fri, Apr 16, 2010 at 3:08 PM, Jonathan Ellis <jb...@gmail.com> wrote:
> On Mon, Apr 12, 2010 at 9:48 AM, Colin Yates <co...@gmail.com> wrote:
>> I was hoping I could do a get_range_slices specifying 'project*' for the
>> columnFamily and a keyRange start: 20100107, end:20100109 but I
>> get an error 'InvalidRequestException(why:unconfigured columnfamily project*)'.
>
> I think you've been misled by the "think of Cassandra as a multi-level
> hash" explanations; you can't wildcard ColumnFamilies like that.  (I
> personally think that the model of "a columnfamily is like a table,
> except that its rows can contain nested columns [supercolumns]" is
> more useful.)
>
> -Jonathan
>

Re: (another) Newbie question

Posted by Jonathan Ellis <jb...@gmail.com>.
On Mon, Apr 12, 2010 at 9:48 AM, Colin Yates <co...@gmail.com> wrote:
> I was hoping I could do a get_range_slices specifying 'project*' for the
> columnFamily and a keyRange start: 20100107, end:20100109 but I
> get an error 'InvalidRequestException(why:unconfigured columnfamily project*)'.

I think you've been misled by the "think of Cassandra as a multi-level
hash" explanations; you can't wildcard ColumnFamilies like that.  (I
personally think that the model of "a columnfamily is like a table,
except that its rows can contain nested columns [supercolumns]" is
more useful.)

-Jonathan