cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sylvain Lebresne (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CASSANDRA-9977) Support counter-columns for native aggregates (sum,avg,max,min)
Date Tue, 15 Dec 2015 16:43:47 GMT

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

Sylvain Lebresne commented on CASSANDRA-9977:
---------------------------------------------

bq. Want to say: you no longer have a counter but just a value which is then "independent"
from its origin

That's pretty ill defined though. When you read a counter directly, you also get "just a value".
For all intent and purposes, we could have return {{bigint}} for a raw select of a counter,
but we don't, so let's be consistent and preserve the {{counter}} type by default. And as
Benjamin mention, if you use the {{max}} function for instance, your "intuition" doesn't really
hold anymore.

I'll note that if people really care about getting a {{bigint}}, they can always cast the
return (haven't checked if we allow casting a counter to a bigint but if we don't, we should)
so its not like we're losing anything. Chances are, almost no-one will notice however.


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

Mime
View raw message