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

Vovodroid commented on CASSANDRA-10272:
---------------------------------------

I added one print to cqlhandling.py
{code}
            if len(stmt) > 2:
                print stmt[0][0] + ' '+ stmt[-3][0]
                if stmt[-3][0] == 'apply':
                    in_batch = False
                elif stmt[0][0] == 'begin':
                    in_batch = True
{code}

and run
{code}./cqlsh -e "BEGIN BATCH INSERT INTO excelsior.data (id) VALUES (0); APPLY 
BATCH ;"{code}

Result is 
{code}
identifier wholenumber
identifier identifier
{code}
So obviously it's neither 'apply' nor 'begin', thus *in_batch* variable is not 
changed.

While before merge it was
{code}
K_BEGIN wholenumber
K_APPLY K_APPLY
{code}
and it was rightfully compared to 'K_BEGIN' and 'K_APPLY'.

So probably something wrong with parsing.

> BATCH statement is broken
> -------------------------
>
>                 Key: CASSANDRA-10272
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-10272
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Core
>         Environment: CentOS 7.1/x64
>            Reporter: Vovodroid
>            Assignee: Ryan McGuire
>            Priority: Minor
>
> BEGIN BATCH .... APPLY BATCH is not parsed correctly.
> Steps:
> {code}
> CREATE KEYSPACE Excelsior  WITH 
> REPLICATION={'class':'SimpleStrategy','replication_factor':1};
> CREATE TABLE excelsior.data (id int primary key);
> BEGIN BATCH INSERT INTO excelsior.data (id) VALUES (0); APPLY BATCH ;
> {code}
> Error
> {code}
> SyntaxException: <ErrorMessage code=2000 [Syntax error in CQL query] 
> message="line 0:-1 mismatched input '<EOF>' expecting K_APPLY">
> SyntaxException: <ErrorMessage code=2000 [Syntax error in CQL query] 
> message="line 1:0 no viable alternative at input 'APPLY' ([APPLY]...)">
> {code}
> While 
> {code}
> BEGIN BATCH INSERT INTO excelsior.data (id) VALUES (0)  APPLY BATCH ;
> {code}
> without *;* after insert works.
> Consequently neither
> {code}
> BEGIN BATCH INSERT INTO excelsior.data (id) VALUES (0);INSERT INTO 
> excelsior.data (id) VALUES (0); APPLY BATCH ;
> {code}
> Error:
> {code}
> SyntaxException: <ErrorMessage code=2000 [Syntax error in CQL query] 
> message="line 0:-1 mismatched input '<EOF>' expecting K_APPLY">
> SyntaxException: <ErrorMessage code=2000 [Syntax error in CQL query] 
> message="line 1:0 no viable alternative at input 'APPLY' ([APPLY]...)">
> {code}
> nor
> {code}
> BEGIN BATCH INSERT INTO excelsior.data (id) VALUES (0);INSERT INTO 
> excelsior.data (id) VALUES (0) APPLY BATCH ;
> {code}
> Error
> {code}
> SyntaxException: <ErrorMessage code=2000 [Syntax error in CQL query] 
> message="line 0:-1 mismatched input '<EOF>' expecting K_APPLY">
> SyntaxException: <ErrorMessage code=2000 [Syntax error in CQL query] 
> message="line 1:43 missing EOF at 'APPLY' (...(id) VALUES (0) [APPLY] 
> BATCH...)">
> {code}
> works.
> It was OK in 2.2.0 and 3.0 beta 1.
> 3.0-beta2-tentative also affected.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to