[ https://issues.apache.org/jira/browse/CASSANDRA-9977?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15044844#comment-15044844 ]
Benjamin Lerer edited comment on CASSANDRA-9977 at 12/7/15 12:26 PM: --------------------------------------------------------------------- My main question with the patch is about the returned type. For a normal {{SELECT}} the type returned within the metadata is {{COUNTER}} but, with the patch, if you use a native aggregate the type returned is {{BIGINT}}. I am not against returning {{BIGINT}} but it does not feel really consistent to me. [~slebresne] What do you think? Otherwise, I only have 2 nits: * I think that {{max}} and {{min}} in {{2.2}} should be implemented the same way than in {{3.0+}} (to avoid relying on the {{CounterType.compare}}) . * It will be nice to also test {{sum}} in the unit test. was (Author: blerer): My main question with the patch is about the returned type. For a normal {{SELECT}} the type returned within the metadata is {{COUNTER}} but, with the patch, if you use a native aggregate the type returned is {{BIGINT}}. I am not against returning {{BIGINT}} but it does not feel really consistent to me. [~slebresne] What do you think? Otherwise, I only have 2 nits: * I think that {{max}} and {{min}} in {{2.2}} should be implemented the same way than in {{3.0+}} (to avoid relying on the {{CounterType.compare}}) . * I will be nice to also test {{sum}} in the unit test. > Support counter-columns for native aggregates (sum,avg,max,min) > --------------------------------------------------------------- > > Key: CASSANDRA-9977 > URL: https://issues.apache.org/jira/browse/CASSANDRA-9977 > Project: Cassandra > Issue Type: Improvement > Components: CQL > Reporter: Noam Liran > Assignee: Robert Stupp > Fix For: 2.2.x > > > When trying to SUM a column of type COUNTER, this error is returned: > {noformat} > InvalidRequest: code=2200 [Invalid query] message="Invalid call to function > sum, none of its type signatures match (known type signatures: system.sum : > (tinyint) -> tinyint, system.sum : (smallint) -> smallint, system.sum : (int) > -> int, system.sum : (bigint) -> bigint, system.sum : (float) -> float, > system.sum : (double) -> double, system.sum : (decimal) -> decimal, > system.sum : (varint) -> varint)" > {noformat} > This might be relevant for other agg. functions. > CQL for reproduction: > {noformat} > CREATE TABLE test ( > key INT, > ctr COUNTER, > PRIMARY KEY ( > key > ) > ); > UPDATE test SET ctr = ctr + 1 WHERE key = 1; > SELECT SUM(ctr) FROM test; > {noformat} -- This message was sent by Atlassian JIRA (v6.3.4#6332)