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

CQL: Unable to escape single quote in a map<int,text> attribute

    XMLWordPrintableJSON

Details

    • Correctness
    • Low
    • Low Hanging Fruit
    • User Report
    • All
    • None
    • Hide

      Unit & cqlsh tests.

      Show
      Unit & cqlsh tests.

    Description

      Overview

      For text attributes, CQL allows escaping single quote using additional single quote. But applying the same syntax for a map<int,text> attribute does not work. Inconsistent behavior was observed between text datatype and map<int,text> datatype.

      CQL semantic proposal

      Cassandra (CQL) should apply same escaping semantics on text and text-within-map map<int,text> datatypes.

      Reproducing the bug:

      CREATE query: 

      CREATE TABLE university.test (id int, data map<int, text>, PRIMARY KEY (id));

       INSERT query: 

      insert into university.test (id, data) values(1, {1:'I''m newb'});

      On running the aforementioned INSERT query, Cassandra inserts and returns {1: 'I''m newb'} while the expected result is {1: 'I'm newb'}

      Technical details 

      OS: CentOS 7

      Kernel: Linux 3.10.0-1062.9.1.el7.x86_64

      Cassandra version: 3.11.5

      Screenshot: Output after SELECT query
       
      Additional information for newcomers:

      The issue seems to come from the ANTLR Lexer logic for STRING_LITERAL. A unit test should also be added in SelectTest

      Attachments

        1. cass-screen.png
          10 kB
          Abhijeet Singh

        Issue Links

          Activity

            People

              yziadeh Yaman Ziadeh
              singh-abhijeet Abhijeet Singh
              Yaman Ziadeh
              Paulo Motta
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m