You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Eunsu Kim <eu...@gmail.com> on 2018/04/09 09:42:06 UTC
Can I sort it as a result of group by?
Hello, everyone.
I am using 3.11.0 and I have the following table.
CREATE TABLE summary_5m (
service_key text,
hash_key int,
instance_hash int,
collected_time timestamp,
count int,
PRIMARY KEY ((service_key), hash_key, instance_hash, collected_time)
)
And I can sum count grouping by primary key.
select service_key, hash_key, instance_hash, sum(count) as count_summ
from apm.ip_summary_5m
where service_key='ABCED'
group by service_key, hash_key, instance_hash;
But what I want is to get only the top 100 with a high value added.
Like following query is attached … (syntax error, of course)
order by count_sum limit 100;
Anybody have ever solved this problem?
Thank you in advance.
Re: Can I sort it as a result of group by?
Posted by onmstester onmstester <on...@zoho.com>.
I'm using apache spark on top of cassandra for such cases
Sent using Zoho Mail
---- On Mon, 09 Apr 2018 18:00:33 +0430 DuyHai Doan <doanduyhai@gmail.com> wrote ----
No, sorting by column other than clustering column is not possible
On Mon, Apr 9, 2018 at 11:42 AM, Eunsu Kim <eunsu.bill23@gmail.com> wrote:
Hello, everyone.
I am using 3.11.0 and I have the following table.
CREATE TABLE summary_5m (
service_key text,
hash_key int,
instance_hash int,
collected_time timestamp,
count int,
PRIMARY KEY ((service_key), hash_key, instance_hash, collected_time)
)
And I can sum count grouping by primary key.
select service_key, hash_key, instance_hash, sum(count) as count_summ
from apm.ip_summary_5m
where service_key='ABCED'
group by service_key, hash_key, instance_hash;
But what I want is to get only the top 100 with a high value added.
Like following query is attached … (syntax error, of course)
order by count_sum limit 100;
Anybody have ever solved this problem?
Thank you in advance.
Re: Can I sort it as a result of group by?
Posted by DuyHai Doan <do...@gmail.com>.
No, sorting by column other than clustering column is not possible
On Mon, Apr 9, 2018 at 11:42 AM, Eunsu Kim <eu...@gmail.com> wrote:
> Hello, everyone.
>
> I am using 3.11.0 and I have the following table.
>
> CREATE TABLE summary_5m (
> service_key text,
> hash_key int,
> instance_hash int,
> collected_time timestamp,
> count int,
> PRIMARY KEY ((service_key), hash_key, instance_hash, collected_time)
> )
>
>
> And I can sum count grouping by primary key.
>
> select service_key, hash_key, instance_hash, sum(count) as count_summ
> from apm.ip_summary_5m
> where service_key='ABCED'
> group by service_key, hash_key, instance_hash;
>
>
> But what I want is to get only the top 100 with a high value added.
>
> Like following query is attached … (syntax error, of course)
>
> order by count_sum limit 100;
>
> Anybody have ever solved this problem?
>
> Thank you in advance.
>
>
>