[
https://issues.apache.org/jira/browse/CASSANDRA-12760?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15879891#comment-15879891
]
Paul Fife commented on CASSANDRA-12760:
---------------------------------------
I was taking a look at this one and found the tests are verifying the
"incorrect" behavior described in this JIRA. I can't find in the official docs
but this post describes the behavior is intended in that both going in and out
case sensitive column names would be in quotes and have an additional backslash
quote at the beginning and end:
http://www.datastax.com/dev/blog/whats-new-in-cassandra-2-2-json-support
"The results of SELECT JSON are designed to be usable in an INSERT JSON
statement without any modifications, so all of the same rules about non-text
map keys and case-sensitive column names apply."
Is this "not a bug"?
> SELECT JSON "firstName" FROM ... results in {"\"firstName\"": "Bill"}
> ---------------------------------------------------------------------
>
> Key: CASSANDRA-12760
> URL: https://issues.apache.org/jira/browse/CASSANDRA-12760
> Project: Cassandra
> Issue Type: Bug
> Components: Core
> Environment: Cassandra 3.7
> Reporter: Niek Bartholomeus
> Assignee: Shivang Nagaria
> Labels: lhf
>
> I'm using Cassandra to store data coming from Spark and intended for being
> consumed by a javascript front end.
> To avoid unnecessary field name mappings I have decided to use mixed case
> fields in Cassandra. I also happily leave it to Cassandra to jsonify the data
> (using SELECT JSON ...) so my scala/play web server can send the results from
> Cassandra straight through to the front end.
> I noticed however that all mixed case fields (that were created with quotes
> as Cassandra demands) end up having a double set of quotes
> {code}
> create table user(id text PRIMARY KEY, "firstName" text);
> insert into user(id, "firstName") values ('b', 'Bill');
> select json * from user;
> [json]
> --------------------------------------
> {"id": "b", "\"firstName\"": "Bill"}
> {code}
> Ideally that would be:
> {code}
> [json]
> --------------------------------------
> {"id": "b", "firstName": "Bill"}
> {code}
> I worked around it for now by removing all "\""'s before sending the json to
> the front end.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)