You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Aaron Morton <aa...@thelastpickle.com> on 2011/01/12 22:07:45 UTC
Re: best way to do a count
There is a get_count() API function http://wiki.apache.org/cassandra/API , it's going to count the columns in a row or row+super column. This function is available in me.prettyprint.cassandra.service.KeyspaceService.
There are distributed counters submitted to the trunk http://wiki.apache.org/cassandra/Counters but these are not in the recent 0.7 release. I lost track of things over the holidays, perhaps someone else knows when these are scheduled to go public.
Aaron
On 13 Jan, 2011,at 09:12 AM, Michael Fortin <mi...@m410.us> wrote:
I was working on a schema that looks something like this:
HitFamily [UUID 1] ['user-agent'] = '…'
HitFamily [UUID 1] ['referer'] = '…'
HitFamily [UUID 1] ['client_id'] = Long
…
HitCountFamily [client_id as Long] [Current Date as Long] = UUID1
What I'd like to do is count the columns between a date rage without returning them. Is it possible to get a count of rows in a slice? Looking at hector and thrift there doesn't seem to be a way to do that. How have other handled this?
Thanks,
Re: cassandra-cli 0.7 "name" as a column name!
Posted by Tyler Hobbs <ty...@riptano.com>.
I created https://issues.apache.org/jira/browse/CASSANDRA-1995 for this.
Thanks for reporting the issue!
- Tyler
On Sun, Jan 16, 2011 at 1:51 PM, kh jo <jo...@yahoo.com> wrote:
> example:
>
> create column family Countries
> with comparator=UTF8Type
> and column_metadata=[
> {column_name: name, validation_class: UTF8Type}
> ];
>
> this gives the following error:
> Command not found: `create column family Countries with comparator=UTF8Type
> and column_metadata=[ {column_name: name, validation_class: UTF8Type} ];`.
> Type 'help' or '?' for help.
>
>
> but the following command works:
> create column family Countries
> with comparator=UTF8Type
> and column_metadata=[
> {column_name: countryName, validation_class: UTF8Type}
> ];
>
>
>
>
>
>
>
>
> this command gives an error:
>
> --- On *Sun, 1/16/11, Tyler Hobbs <ty...@riptano.com>* wrote:
>
>
> From: Tyler Hobbs <ty...@riptano.com>
> Subject: Re: cassandra-cli 0.7 "name" as a column name!
> To: user@cassandra.apache.org
> Date: Sunday, January 16, 2011, 8:30 PM
>
>
> You can.
>
> Can you give us the line that you are trying to execute?
>
> - Tyler
>
> On Sun, Jan 16, 2011 at 1:22 PM, kh jo <jo...@yahoo.com>
> > wrote:
>
> Why can't I use "name" as a column name?
>
>
>
>
Re: cassandra-cli 0.7 "name" as a column name!
Posted by kh jo <jo...@yahoo.com>.
example:
create column family Countries
with comparator=UTF8Type
and column_metadata=[
{column_name: name, validation_class: UTF8Type}
];
this gives the following error:
Command not found: `create column family Countries with comparator=UTF8Type and column_metadata=[ {column_name: name, validation_class: UTF8Type} ];`. Type 'help' or '?' for help.
but the following command works:
create column family Countries
with comparator=UTF8Type
and column_metadata=[
{column_name: countryName, validation_class: UTF8Type}
];
this command gives an error:
--- On Sun, 1/16/11, Tyler Hobbs <ty...@riptano.com> wrote:
From: Tyler Hobbs <ty...@riptano.com>
Subject: Re: cassandra-cli 0.7 "name" as a column name!
To: user@cassandra.apache.org
Date: Sunday, January 16, 2011, 8:30 PM
You can.
Can you give us the line that you are trying to execute?
- Tyler
On Sun, Jan 16, 2011 at 1:22 PM, kh jo <jo...@yahoo.com> wrote:
Why can't I use "name" as a column name?
Re: cassandra-cli 0.7 "name" as a column name!
Posted by Tyler Hobbs <ty...@riptano.com>.
You can.
Can you give us the line that you are trying to execute?
- Tyler
On Sun, Jan 16, 2011 at 1:22 PM, kh jo <jo...@yahoo.com> wrote:
> Why can't I use "name" as a column name?
>
>
Re: best way to do a count
Posted by Aaron Morton <aa...@thelastpickle.com>.
Ah, was looking at something old.
There is also a multiget_count() :)
Sounds like your in business.
Aaron
On 17/01/2011, at 11:08 AM, Brandon Williams <dr...@gmail.com> wrote:
> On Sun, Jan 16, 2011 at 3:36 PM, Aaron Morton <aa...@thelastpickle.com> wrote:
> Not that I know of.
>
> In 0.7 you have to pass a predicate to get_count (and use a small hack to get the old behavior: https://github.com/driftx/Telephus/blob/0.7/telephus/client.py#L109 )
>
> -Brandon
Re: best way to do a count
Posted by Brandon Williams <dr...@gmail.com>.
On Sun, Jan 16, 2011 at 3:36 PM, Aaron Morton <aa...@thelastpickle.com>wrote:
> Not that I know of.
>
In 0.7 you have to pass a predicate to get_count (and use a small hack to
get the old behavior:
https://github.com/driftx/Telephus/blob/0.7/telephus/client.py#L109 )
-Brandon
Re: best way to do a count
Posted by Aaron Morton <aa...@thelastpickle.com>.
Not that I know of.
Can you share some more information on you application, you may be able to design your way around it by denormalising.
Aaron
On 17/01/2011, at 5:22 AM, Michael Fortin <mi...@m410.us> wrote:
> From what I can tell, get_count(), returns the total number of columns, is there a way to get the count on a slice? The docs for Counters also doesn't make any references to slices either.
>
> On Jan 12, 2011, at 4:07 PM, Aaron Morton wrote:
>
>> There is a get_count() API function http://wiki.apache.org/cassandra/API , it's going to count the columns in a row or row+super column. This function is available in me.prettyprint.cassandra.service.KeyspaceService.
>>
>> There are distributed counters submitted to the trunk http://wiki.apache.org/cassandra/Counters but these are not in the recent 0.7 release. I lost track of things over the holidays, perhaps someone else knows when these are scheduled to go public.
>>
>> Aaron
>>
>> On 13 Jan, 2011,at 09:12 AM, Michael Fortin <mi...@m410.us> wrote:
>>
>>> I was working on a schema that looks something like this:
>>>
>>> HitFamily [UUID 1] ['user-agent'] = '…'
>>> HitFamily [UUID 1] ['referer'] = '…'
>>> HitFamily [UUID 1] ['client_id'] = Long
>>> …
>>>
>>> HitCountFamily [client_id as Long] [Current Date as Long] = UUID1
>>>
>>>
>>> What I'd like to do is count the columns between a date rage without returning them. Is it possible to get a count of rows in a slice? Looking at hector and thrift there doesn't seem to be a way to do that. How have other handled this?
>>>
>>> Thanks,
>>>
>
cassandra-cli 0.7 "name" as a column name!
Posted by kh jo <jo...@yahoo.com>.
Why can't I use "name" as a column name?
Re: best way to do a count
Posted by Michael Fortin <mi...@m410.us>.
From what I can tell, get_count(), returns the total number of columns, is there a way to get the count on a slice? The docs for Counters also doesn't make any references to slices either.
On Jan 12, 2011, at 4:07 PM, Aaron Morton wrote:
> There is a get_count() API function http://wiki.apache.org/cassandra/API , it's going to count the columns in a row or row+super column. This function is available in me.prettyprint.cassandra.service.KeyspaceService.
>
> There are distributed counters submitted to the trunk http://wiki.apache.org/cassandra/Counters but these are not in the recent 0.7 release. I lost track of things over the holidays, perhaps someone else knows when these are scheduled to go public.
>
> Aaron
>
> On 13 Jan, 2011,at 09:12 AM, Michael Fortin <mi...@m410.us> wrote:
>
>> I was working on a schema that looks something like this:
>>
>> HitFamily [UUID 1] ['user-agent'] = '…'
>> HitFamily [UUID 1] ['referer'] = '…'
>> HitFamily [UUID 1] ['client_id'] = Long
>> …
>>
>> HitCountFamily [client_id as Long] [Current Date as Long] = UUID1
>>
>>
>> What I'd like to do is count the columns between a date rage without returning them. Is it possible to get a count of rows in a slice? Looking at hector and thrift there doesn't seem to be a way to do that. How have other handled this?
>>
>> Thanks,
>>