Zach,

this is embarrassing.....you were right, I was running 2.1!!!!

shame on me! but now I'm getting the error:

*InvalidRequest: code=2200 [Invalid query] message="JSON values map
contains unrecognized column: address"*
any idea? This is the sequence of commands that I'm running:

CREATE KEYSPACE json WITH REPLICATION = { 'class' :'SimpleStrategy',
'replication_factor' : 1 };

USE json;

CREATE TYPE address (street text,city text,zip_code int,phones set<text>);

CREATE TABLE users (id int PRIMARY KEY,name text,addresses map<text,
frozen<address>>);

INSERT INTO users JSON  '{"id": 123,"name": "jbellis","address": {"home": {
"street": "123 Cassandra Dr","city":"Austin","zip_code": 78747,"phones": [
2101234567]}}}';


Consider that I'm running a "just downloaded" C2.2 instance (I'm on a mac)

Thanks and sorry for the waste of time before!






On Mon, Jun 1, 2015 at 7:10 PM, Zach Kurey <zach.ku...@datastax.com> wrote:

> Hi Michel,
>
> My only other guess is that you actually are running Cassandra 2.1, since
> thats the exact error I get if I try to execute a JSON statement against a
> version earlier than 2.2.
>
>
>
> On Mon, Jun 1, 2015 at 6:13 PM, Michel Blase <mblas...@gmail.com> wrote:
>
>> Thanks Zach,
>>
>> tried that but I get the same error:
>>
>> *SyntaxException: <ErrorMessage code=2000 [Syntax error in CQL query]
>> message="line 1:24 mismatched input '{"id": 123,"name":
>> "jbellis","address": {"home": {"street": "123 Cassandra Dr","city":
>> "Austin","zip_code": 78747,"phones": [2101234567]}}}' expecting ')' (INSERT
>> INTO users JSON  ['{"id": 123,"name": "jbellis","address": {"home":
>> {"street": "123 Cassandra Dr","city": "Austin","zip_code": 78747,"phones":
>> [2101234567]}}]}';)">*
>>
>> On Mon, Jun 1, 2015 at 6:12 PM, Zach Kurey <zach.ku...@datastax.com>
>> wrote:
>>
>>> Looks like you have your use of single vs. double quotes inverted.  What
>>> you want is:
>>>
>>> INSERT INTO users JSON  '{"id": 123,"name": "jbellis","address": {"home":
>>> {"street": "123 Cassandra Dr","city": "Austin","zip_code": 78747,
>>> "phones": [2101234567]}}}';
>>>
>>> HTH
>>>
>>> On Mon, Jun 1, 2015 at 6:03 PM, Michel Blase <mblas...@gmail.com> wrote:
>>>
>>>> Hi all,
>>>>
>>>> I'm trying to test the new JSON functionalities in C* 2.2.
>>>>
>>>> I'm using this example:
>>>>
>>>> https://issues.apache.org/jira/browse/CASSANDRA-7970
>>>>
>>>> I believe there is a typo in the CREATE TABLE statement that requires
>>>> frozen:
>>>>
>>>> CREATE TABLE users (id int PRIMARY KEY,name text,addresses map<text,
>>>> frozen<address>>);
>>>>
>>>> but my real problem is in the insert syntax. I've found the CQL-2.2
>>>> documentation and my best guess is this:
>>>>
>>>> INSERT INTO users JSON "{'id': 123,'name': 'jbellis','address':
>>>> {'home': {'street': '123 Cassandra Dr','city': 'Austin','zip_code':
>>>> 78747,'phones': [2101234567]}}}";
>>>>
>>>> but I get the error:
>>>>
>>>> SyntaxException: <ErrorMessage code=2000 [Syntax error in CQL query]
>>>> message="line 1:23 mismatched input '{'id': 123,'name':
>>>> 'jbellis','address': {'home': {'street': '123 Cassandra Dr','city':
>>>> 'Austin','zip_code': 78747,'phones': [2101234567]}}}' expecting ')' (INSERT
>>>> INTO users JSON ["{'id': 123,'name': 'jbellis','address': {'home':
>>>> {'street': '123 Cassandra Dr','city': 'Austin','zip_code': 78747,'phones':
>>>> [2101234567]}}]}";)">
>>>>
>>>>
>>>> Any idea?
>>>>
>>>>
>>>> Thanks,
>>>>
>>>> Michael
>>>>
>>>>
>>>>
>>>
>>
>

Reply via email to