Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-10272

BATCH statement is broken in cqlsh

    XMLWordPrintableJSON

    Details

    • Severity:
      Normal
    • Since Version:

      Description

      BEGIN BATCH .... APPLY BATCH is not parsed correctly.

      Steps:

      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 ;
      

      Error

      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]...)">
      

      While

      BEGIN BATCH INSERT INTO excelsior.data (id) VALUES (0)  APPLY BATCH ;
      

      without ; after insert works.

      Consequently neither

      BEGIN BATCH INSERT INTO excelsior.data (id) VALUES (0);INSERT INTO excelsior.data (id) VALUES (0); APPLY BATCH ;
      

      Error:

      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]...)">
      

      nor

      BEGIN BATCH INSERT INTO excelsior.data (id) VALUES (0);INSERT INTO excelsior.data (id) VALUES (0) APPLY BATCH ;
      

      Error

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

      works.

      It was OK in 2.2.0 and 3.0 beta 1.
      3.0-beta2-tentative also affected.

        Attachments

        1. 10272-2.1.txt
          1 kB
          Stefania Alborghetti

          Issue Links

            Activity

              People

              • Assignee:
                stefania Stefania Alborghetti
                Reporter:
                vovodroid Vovodroid
                Authors:
                Stefania Alborghetti
                Reviewers:
                Robert Stupp
                Tester:
                Jim Witschey
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: