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

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

The last patch looks almost good to go (provided it's rebased) for me but there 
seems to be some confusion around the {{reset}} method for {{Selection}}. 
You've removed the abstract one in {{Selection}} itself, but both 
{{SimpleSelection}} and {{SelectionWithFunctions}} still have a {{reset}} 
method which, as far as I can tell, is never called. And while the one in 
{{SimpleSelection}} does nothing, the one in {{SelectionWithFunctions}} seems 
to do something. I think what you'd want is add back the {{reset}} method to 
{{Selection}} but actually call it in {{ResultSetBuilder.newRow/build}} (as a 
nit, you can then move the {{current = null}} in {{SimpleSelection}} in the 
{{reset}} method for consistency).

bq.  Postgres's approach to user-defined aggregation functions is almost 
exactly this: http://www.postgresql.org/docs/8.3/static/sql-createaggregate.html

I agree that it's where we want to go (there was some discussion around this at 
the bootcamp that ended up with the same conclusion but it sound like I forgot 
to update JIRA with said conclusions). That said, this ticket is mostly about 
the internal interface for aggregation functions and as far as I can tell, 
nothing in the attached patch limit us from going with a "reduce-style" 
approach for UDF (it will be in fact rather simple). So let's maybe leave the 
discussion on UDF in CASSANDRA-8053.

> 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-V4.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)

Reply via email to