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

Sylvain Lebresne commented on CASSANDRA-4914:
---------------------------------------------

bq. The syntax or the intent?

Hum, I guess those where suppose to be concrete string of the arguments, like 
"salary".

So, the way the current functions are implemented, a function interface is a 
name, the type of it's arguments and return type, and a simple 'ByteBuffer 
execute(List<ByteBuffer> args)' method. How the function gets his arguments is 
"externalized" in the Selection class. What I mean here, is that if you write:
{noformat}
SELECT t, dateOf(t) FROM ...;
{noformat}
then the method dateOf itself never care about the fact it is applied to "t", 
this is the job of Selection.java. The advantage is that it makes it easy to 
compose function if you want to, say:
{noformat}
SELECT t, dateOf(blobAsTimeuuid(b)) FROM ...;
{noformat}

So the difference between a "conversion" function like dateOf or blobAsTimeuuid 
and an aggregation one like sum is that the latter group multiple row to get a 
result. So maybe all you want is that it's execute is:
{noformat}
ByteBuffer execute(List<List<ByteBuffer>> valuesToAggregate);
{noformat}
                
> Aggregate functions in CQL
> --------------------------
>
>                 Key: CASSANDRA-4914
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4914
>             Project: Cassandra
>          Issue Type: Bug
>            Reporter: Vijay
>            Assignee: Vijay
>             Fix For: 2.0
>
>
> 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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to