[ 
https://issues.apache.org/jira/browse/CASSANDRA-18967?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Luis E Fernandez updated CASSANDRA-18967:
-----------------------------------------
    Description: 
*System configuration and information:*

Single node Cassandra with Accord transactions enabled running on docker

Built from commit: 
[a7cd114435704b988c81f47ef53d0bfd6441f38b|https://github.com/apache/cassandra/commit/a7cd114435704b988c81f47ef53d0bfd6441f38b]

CQLSH: [cqlsh 6.2.0 | Cassandra 5.0-alpha2-SNAPSHOT | CQL spec 3.4.7 | Native 
protocol v5]

 

*Steps to reproduce in CQLSH:*
{code:java}
CREATE KEYSPACE accord WITH replication = {'class': 'SimpleStrategy', 
'replication_factor': '1'}  AND durable_writes = true;{code}
{code:java}
CREATE TABLE accord.accounts (
    partition text,
    account_id int,
    balance int,
    PRIMARY KEY (partition, account_id)
) WITH CLUSTERING ORDER BY (account_id ASC)
{code}
{code:java}
BEGIN TRANSACTION
    INSERT INTO accord.accounts (partition, account_id, balance) VALUES 
('default', 0, 100);
    INSERT INTO accord.accounts (partition, account_id, balance) VALUES 
('default', 1, 100);
COMMIT TRANSACTION;{code}
bug happens after executing the following statement:

I expect the result to be a single row consisting of the sum of all the 
balances (100 + 100 = 200).
{code:java}
BEGIN TRANSACTION
    SELECT SUM(balance)
    FROM accord.accounts
    WHERE
      partition = 'default'
      AND account_id IN (0, 1);
COMMIT TRANSACTION;{code}
 

Bug / Error:
======================================================================

The return result includes all the rows with no sum.
{code:java}
system.sum(balance)
----------------
            100
            100{code}
 

Note that executing the same statement without the transaction returns the 
expected result:
{code:java}
system.sum(balance)
----------------
            200{code}
{color:#172b4d}This was found while testing Accord transactions with 
[~henrik.ingo] and team.{color}

  was:
*System configuration and information:*

Single node Cassandra with Accord transactions enabled running on docker

Built from commit: 
[a7cd114435704b988c81f47ef53d0bfd6441f38b|https://github.com/apache/cassandra/commit/a7cd114435704b988c81f47ef53d0bfd6441f38b]

CQLSH: [cqlsh 6.2.0 | Cassandra 5.0-alpha2-SNAPSHOT | CQL spec 3.4.7 | Native 
protocol v5]

 

*Steps to reproduce in CQLSH:*
{code:java}
CREATE KEYSPACE accord WITH replication = {'class': 'SimpleStrategy', 
'replication_factor': '1'}  AND durable_writes = true;{code}
{code:java}
CREATE TABLE accord.accounts (
    partition text,
    account_id int,
    balance int,
    PRIMARY KEY (partition, account_id)
) WITH CLUSTERING ORDER BY (account_id ASC)
{code}
{code:java}
BEGIN TRANSACTION
    INSERT INTO accord.accounts (partition, account_id, balance) VALUES 
('default', 0, 100);
    INSERT INTO accord.accounts (partition, account_id, balance) VALUES 
('default', 1, 100);
COMMIT TRANSACTION;{code}
bug happens after executing the following statement:

I expect the result to be a single row consisting of the sum of all the 
balances (100 + 100 = 200).
{code:java}
BEGIN TRANSACTION
    SELECT SUM(balance)
    FROM accord.accounts
    WHERE
      partition = 'default'
      AND account_id IN (0, 1);
COMMIT TRANSACTION;{code}
 

Bug / Error:
======================================================================

The return result includes all the rows with no sum.
{code:java}
system.sum(balance)
----------------
            100
            100{code}
 

Note that executing the same statement without the transaction returns the 
expected result:
{code:java}
system.sum(balance)
----------------
            200{code}
{color:#172b4d}This is found while testing Accord transactions with 
[~henrik.ingo] and team.{color}


> Aggregation (SUM) in a transaction block fails
> ----------------------------------------------
>
>                 Key: CASSANDRA-18967
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-18967
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Accord
>            Reporter: Luis E Fernandez
>            Priority: Normal
>             Fix For: 5.x
>
>
> *System configuration and information:*
> Single node Cassandra with Accord transactions enabled running on docker
> Built from commit: 
> [a7cd114435704b988c81f47ef53d0bfd6441f38b|https://github.com/apache/cassandra/commit/a7cd114435704b988c81f47ef53d0bfd6441f38b]
> CQLSH: [cqlsh 6.2.0 | Cassandra 5.0-alpha2-SNAPSHOT | CQL spec 3.4.7 | Native 
> protocol v5]
>  
> *Steps to reproduce in CQLSH:*
> {code:java}
> CREATE KEYSPACE accord WITH replication = {'class': 'SimpleStrategy', 
> 'replication_factor': '1'}  AND durable_writes = true;{code}
> {code:java}
> CREATE TABLE accord.accounts (
>     partition text,
>     account_id int,
>     balance int,
>     PRIMARY KEY (partition, account_id)
> ) WITH CLUSTERING ORDER BY (account_id ASC)
> {code}
> {code:java}
> BEGIN TRANSACTION
>     INSERT INTO accord.accounts (partition, account_id, balance) VALUES 
> ('default', 0, 100);
>     INSERT INTO accord.accounts (partition, account_id, balance) VALUES 
> ('default', 1, 100);
> COMMIT TRANSACTION;{code}
> bug happens after executing the following statement:
> I expect the result to be a single row consisting of the sum of all the 
> balances (100 + 100 = 200).
> {code:java}
> BEGIN TRANSACTION
>     SELECT SUM(balance)
>     FROM accord.accounts
>     WHERE
>       partition = 'default'
>       AND account_id IN (0, 1);
> COMMIT TRANSACTION;{code}
>  
> Bug / Error:
> ======================================================================
> The return result includes all the rows with no sum.
> {code:java}
> system.sum(balance)
> ----------------
>             100
>             100{code}
>  
> Note that executing the same statement without the transaction returns the 
> expected result:
> {code:java}
> system.sum(balance)
> ----------------
>             200{code}
> {color:#172b4d}This was found while testing Accord transactions with 
> [~henrik.ingo] and team.{color}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to