Details
-
Bug
-
Status: Resolved
-
Normal
-
Resolution: Not A Problem
-
None
-
Correctness
-
Low
-
Low Hanging Fruit
-
User Report
-
All
-
None
-
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
Attachments
Issue Links
- is duplicated by
-
CASSANDRA-10263 Insert in Cassandra in a collection, values with single quote
- Resolved
- is related to
-
CASSANDRA-17238 Constants$Literal.getText does not escape ' chars
- Resolved
- relates to
-
CASSANDRA-18170 Document cqlsh single quote escaping behavior on complex vs simple types
- Resolved