[ https://issues.apache.org/jira/browse/CASSANDRA-18965?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18015766#comment-18015766 ]
Ling Mao commented on CASSANDRA-18965: -------------------------------------- The following works: {code:java} drop table accord.accounts; drop keyspace accord; CREATE KEYSPACE accord WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'} AND durable_writes = true; CREATE TABLE accord.accounts ( partition_key text, account_id int, balance int, PRIMARY KEY (partition_key, account_id) ) WITH CLUSTERING ORDER BY (account_id ASC) and transactional_mode = 'full'; INSERT INTO accord.accounts (partition_key, account_id, balance) VALUES ('default', 1, 1000); BEGIN TRANSACTION SELECT CAST(balance + 50 AS int) AS new_balance FROM accord.accounts WHERE partition_key='default' AND account_id=1; COMMIT TRANSACTION; {code} > IllegalArgumentException "tuple is null" thrown for illegal syntax in cql > transaction block > ------------------------------------------------------------------------------------------- > > Key: CASSANDRA-18965 > URL: https://issues.apache.org/jira/browse/CASSANDRA-18965 > Project: Apache 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_key text, > account_id int, > balance int, > PRIMARY KEY (partition_key, account_id) > ) WITH CLUSTERING ORDER BY (account_id ASC){code} > {code:java} > INSERT INTO accord.accounts (partition_key, account_id, balance) VALUES > ('default', 1, 1000);{code} > bug happens after executing the following statement: > After assigning a variable within the transaction block, we are attempting to > perform arithmetic operations in the next SELECT statement. Without the > arithmetic operation, the SELECT statement is valid. Instead of reporting an > IllegalArgumentException, CQL should probably just report invalid syntax. > {code:java} > BEGIN TRANSACTION LET row = (SELECT * FROM accord.accounts WHERE > partition_key = 'default' AND account_id = 1); SELECT (row.balance + 50); > COMMIT TRANSACTION;{code} > > Bug / Error: > ====================================================================== > {color:#de350b}SyntaxException: Failed parsing statement: [BEGIN TRANSACTION > LET row = (SELECT * FROM accord.accounts WHERE partition_key = 'default' AND > account_id = 1); SELECT (row.balance + 50); COMMIT TRANSACTION;] reason: > IllegalArgumentException tuple is null{color} > > {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: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org