[jira] [Commented] (CASSANDRA-9977) Support counter-columns for native aggregates (sum,avg,max,min)
[ https://issues.apache.org/jira/browse/CASSANDRA-9977?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15081215#comment-15081215 ] Benjamin Lerer commented on CASSANDRA-9977: --- LGTM > 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.5, 3.0.3 > > > 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)
[jira] [Commented] (CASSANDRA-9977) Support counter-columns for native aggregates (sum,avg,max,min)
[ https://issues.apache.org/jira/browse/CASSANDRA-9977?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15075100#comment-15075100 ] Robert Stupp commented on CASSANDRA-9977: - Yea - I already deleted all my branches for 9977 - so the branch is a re-implementation (that's why I'm asking for another review). Sorry about that. > 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.5, 3.0.3 > > > 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)
[jira] [Commented] (CASSANDRA-9977) Support counter-columns for native aggregates (sum,avg,max,min)
[ https://issues.apache.org/jira/browse/CASSANDRA-9977?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15074804#comment-15074804 ] Benjamin Lerer commented on CASSANDRA-9977: --- There seems to be no changes in your branch. Did I miss something? > 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.5, 3.0.3 > > > 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)
[jira] [Commented] (CASSANDRA-9977) Support counter-columns for native aggregates (sum,avg,max,min)
[ https://issues.apache.org/jira/browse/CASSANDRA-9977?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15070961#comment-15070961 ] Benjamin Lerer commented on CASSANDRA-9977: --- Thanks, +1 > 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)
[jira] [Commented] (CASSANDRA-9977) Support counter-columns for native aggregates (sum,avg,max,min)
[ https://issues.apache.org/jira/browse/CASSANDRA-9977?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15069657#comment-15069657 ] Robert Stupp commented on CASSANDRA-9977: - Updated the tests with the nits and scheduled a testall + dtest runs for all three branches. > 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)
[jira] [Commented] (CASSANDRA-9977) Support counter-columns for native aggregates (sum,avg,max,min)
[ https://issues.apache.org/jira/browse/CASSANDRA-9977?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15067842#comment-15067842 ] Benjamin Lerer commented on CASSANDRA-9977: --- I have just have 2 small nits: * It will be nice to also test {{sum}} in the unit tests. * You can use {{CQLTester.flush()}} instead of {{StorageService.instance.forceKeyspaceFlush}} Could you schedule another run for trunk as well for extra safety? > 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)
[jira] [Commented] (CASSANDRA-9977) Support counter-columns for native aggregates (sum,avg,max,min)
[ https://issues.apache.org/jira/browse/CASSANDRA-9977?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15066768#comment-15066768 ] Robert Stupp commented on CASSANDRA-9977: - Updated the 2.2 and 3.0 branches (trunk is just a merge from 3.0) to use {{counter}} type. Previous cassci results look fine, but scheduled another run since I've rebased the branches. > 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)
[jira] [Commented] (CASSANDRA-9977) Support counter-columns for native aggregates (sum,avg,max,min)
[ https://issues.apache.org/jira/browse/CASSANDRA-9977?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15064257#comment-15064257 ] Robert Stupp commented on CASSANDRA-9977: - Fair enough. Will change it to {{counter}} type in the branch. > 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)
[jira] [Commented] (CASSANDRA-9977) Support counter-columns for native aggregates (sum,avg,max,min)
[ 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)
[jira] [Commented] (CASSANDRA-9977) Support counter-columns for native aggregates (sum,avg,max,min)
[ https://issues.apache.org/jira/browse/CASSANDRA-9977?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15049370#comment-15049370 ] Benjamin Lerer commented on CASSANDRA-9977: --- If was a Cassandra user that do not know how the counters are internally working and that {{SELECT b FROM myTable}} return a {{counter}} type while {{SELECT max(b) FROM myTable}} return a {{bigint}}, I think I would be surprise. My perference would be to be as consistent as possible but I won't fight for it. > 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)
[jira] [Commented] (CASSANDRA-9977) Support counter-columns for native aggregates (sum,avg,max,min)
[ https://issues.apache.org/jira/browse/CASSANDRA-9977?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15046389#comment-15046389 ] Robert Stupp commented on CASSANDRA-9977: - The reason why I've "changed" the aggregates' return type from {{counter}} to {{bigint}} is that for me t's more intuitive as you don't get a real "counter" back from these functions. Mean, if you {{sum}} on counter column values, you add their _current values_ and get one _value_ back - but not a counter. Want to say: you no longer have a counter but just a value which is then "independent" from its origin. WDYT? > 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)
[jira] [Commented] (CASSANDRA-9977) Support counter-columns for native aggregates (sum,avg,max,min)
[ https://issues.apache.org/jira/browse/CASSANDRA-9977?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15045020#comment-15045020 ] Sylvain Lebresne commented on CASSANDRA-9977: - bq. 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 don't think returning one or the other makes much practical difference as {{counter}} and {{bigint}} are pretty much the same thing as far as reads are concerned. I do agree that returning {{counter}} feels more consistent so I would go for that, but that's arguably more of a personal preference than anything else. > 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)
[jira] [Commented] (CASSANDRA-9977) Support counter-columns for native aggregates (sum,avg,max,min)
[ https://issues.apache.org/jira/browse/CASSANDRA-9977?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15044844#comment-15044844 ] Benjamin Lerer commented on CASSANDRA-9977: --- 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)