cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benjamin Lerer (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CASSANDRA-4914) Aggregation functions in CQL
Date Sun, 14 Sep 2014 21:28:36 GMT

    [ https://issues.apache.org/jira/browse/CASSANDRA-4914?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14133395#comment-14133395
] 

Benjamin Lerer commented on CASSANDRA-4914:
-------------------------------------------

bq. Nice work, Benjamin Lerer :-)

Thanks Robert.
 
bq.  Regarding COUNT(*)/COUNT(1) - can you change/extend that to also allow COUNT(any_column)
or even COUNT(func_call)? The v3 patch does not handle this.

It is already there. See last line of AggregationTest.testFunctions()

bq.    Can you add a test to check whether an aggregate works against a UDF and vice versa?
E.g. some "sin" function: SELECT sin(max(a)) FROM foo or SELECT max(sin(a)) FROM foo

The first form is already there. See AggregationTest.testNestedFunctions(). I will add the
second form.

bq. The aggregate functions do only return their input type. Means: overflows are not handled.
It's not a problem for the BigDecimal/BigInteger implementations but for all the others. Maybe
it's better to do all sum+avg on the BigDecimal/BigInteger types and always return them -
although it's slower, the result will be correct. As a nice side effect it could be possible
to reduce the number of avg/sum implementations and let them extend some few impls.

See first feed back from Sylvain

bq.    The implementations of the aggregate functions are sometimes declared using public
static final and sometimes using public static - nice to have: make them look equal

I will fix it.


> Aggregation functions in CQL
> ----------------------------
>
>                 Key: CASSANDRA-4914
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4914
>             Project: Cassandra
>          Issue Type: New Feature
>            Reporter: Vijay
>            Assignee: Benjamin Lerer
>              Labels: cql, docs
>             Fix For: 3.0
>
>         Attachments: CASSANDRA-4914-V2.txt, CASSANDRA-4914-V3.txt, CASSANDRA-4914.txt
>
>
> The requirement is to do aggregation of data in Cassandra (Wide row of column values
of int, double, float etc).
> With some basic agree gate functions like AVG, SUM, Mean, Min, Max, etc (for the columns
within a row).
> Example:
> SELECT * FROM emp WHERE empID IN (130) ORDER BY deptID DESC;                        
           
>  empid | deptid | first_name | last_name | salary
> -------+--------+------------+-----------+--------
>    130 |      3 |     joe    |     doe   |   10.1
>    130 |      2 |     joe    |     doe   |    100
>    130 |      1 |     joe    |     doe   |  1e+03
>  
> SELECT sum(salary), empid FROM emp WHERE empID IN (130);                            
       
>  sum(salary) | empid
> -------------+--------
>    1110.1    |  130



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message