Re: Re: ask for help about exmples of Data Types the document shows

2016-09-27 Thread zha...@easemob.com
Jeff and Jon, thanks for your outstanding work, and expect for the two update. 
^^ 



zha...@easemob.com
 
From: Jeff Jirsa
Date: 2016-09-28 13:01
To: user@cassandra.apache.org
Subject: Re: ask for help about exmples of Data Types the document shows
Jon Haddad opened a ticket (presumably based off this email) - 
https://issues.apache.org/jira/browse/CASSANDRA-12718
 
Will get it corrected shortly.
 
 
From: "zha...@easemob.com" 
Reply-To: "user@cassandra.apache.org" 
Date: Tuesday, September 27, 2016 at 9:57 PM
To: user 
Subject: Re: Re: ask for help about exmples of Data Types the document shows
 
hi, Ben, you are right, I copy the statement from document but not check it 
carefully. It's very helpful and thank a lot !
 
By the way, is there any way to report to the document author and update the 
document? I think it may be confused for a green hand just like me.
 


zha...@easemob.com
 
From: Ben Slater
Date: 2016-09-28 12:50
To: user
Subject: Re: Re: ask for help about exmples of Data Types the document shows
My best guess it that you need to remove the quotes from around the zip values 
(ie change if to  zip: 20500 rather than zip: ‘20500’ ) as zip is defined as an 
int. 
 
Cheers
Ben
 
On Wed, 28 Sep 2016 at 14:38 zha...@easemob.com  wrote:
Hi, Ben Slater, thank you very much for your replay!
 
my cassandra version is 3.7, so I think there must be some thing  I 
misunderstand  ahout frozen type. I add a comma between } and ‘work’, the 
result is like below. Is there some special form  about " type frozen"?
 
cqlsh:counterks> INSERT INTO user (name, addresses) VALUES ('z3 Pr3z1den7', 
{'home' : {street: '1600 Pennsylvania Ave NW',city: 'Washington',zip: 
'20500',phones: { 'cell' : { country_code: 1, number: '202 456-' 
},'landline' : { country_code: 1, number: '...' } }},'work' : {street: '1600 
Pennsylvania Ave NW',city: 'Washington',zip: '20500',phones: { 'fax' : { 
country_code: 1, number: '...' } }}});
InvalidRequest: code=2200 [Invalid query] message="Invalid map literal for 
addresses: value {city: 'Washington', zip: '20500', street: '1600 Pennsylvania 
Ave NW', phones: {'cell': {number: '202 456-', country_code: 1}, 
'landline': {number: '...', country_code: 1}}} is not of type frozen" 
 
my create statements about table and type are:
 
cqlsh:counterks> CREATE TYPE phone ( country_code int, number text, );
cqlsh:counterks> CREATE TYPE address ( street text, city text, zip 
int, phones map );
cqlsh:counterks> CREATE TABLE user (
 ... name text PRIMARY KEY,
 ... addresses map
 ... );
 
 
 


zha...@easemob.com
 
From: Ben Slater
Date: 2016-09-28 11:29
To: user
Subject: Re: ask for help about exmples of Data Types the document shows
Hi, 
 
I think you are right about the typo in (1). For (2), I think you’re missing a 
comma between } and ‘work’ so the JSON is invalid.
 
I think reading this JIRA https://issues.apache.org/jira/browse/CASSANDRA-7423 
that the change requiring  a UDT as part of a collection to be explicitly 
marked as frozen is relatively recent (3.6) so the doco may be out date there.
 
Cheers
Ben
 
On Wed, 28 Sep 2016 at 13:12 zha...@easemob.com  wrote:
hi, everyone, I'm learning Cassandra now , and have some problems about the 
document of "Data Types" .  I don't know where to report or ask for help, so 
I'm very sorry if this mail bother you.
 
In the chapter The Cassandra Query Language (CQL)/Data Types 
(http://cassandra.apache.org/doc/latest/cql/types.html), I'm confused with two 
examples the document showing below. My enviroment is:
 
CentOS release 6.8 (Final)
 
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)
 
Python 2.7.11
 
Cassandra version: 3.7
CQL version: [cqlsh 5.0.1 | Cassandra 3.7 | CQL spec 3.4.2 | Native protocol v4]
 
 
1、 in http://cassandra.apache.org/doc/latest/cql/types.html, when describing 
type set, the giving example is:
CREATE TABLE images (name text PRIMARY KEY,owner text,tags 
set // A set of text values);INSERT INTO images (name, owner, tags)   
 VALUES ('cat.jpg', 'jsmith', { 'pet', 'cute' });// Replace the existing 
set entirelyUPDATE images SET tags = { 'kitten', 'cat', 'lol' } WHERE id = 
'jsmith';
the update cql statement uses "WHERE id = 'jsmith'" while the table images did 
not define key "id". I think it's just a slip of the pen.
 
2、 in http://cassandra.apache.org/doc/latest/cql/types.html, when describing 
“User-Defined Types”,  the giving example is:
CREATE TYPE phone (
country_code int,number text,)CREATE TYPE address (street text,
city text,zip int,phones map)CREATE TABLE user (name 
text PRIMARY KEY,addresses map)
and when I try to create type 

Re: ask for help about exmples of Data Types the document shows

2016-09-27 Thread Jeff Jirsa
Jon Haddad opened a ticket (presumably based off this email) - 
https://issues.apache.org/jira/browse/CASSANDRA-12718

 

Will get it corrected shortly.

 

 

 

From: "zha...@easemob.com" 
Reply-To: "user@cassandra.apache.org" 
Date: Tuesday, September 27, 2016 at 9:57 PM
To: user 
Subject: Re: Re: ask for help about exmples of Data Types the document shows

 

hi, Ben, you are right, I copy the statement from document but not check it 
carefully. It's very helpful and thank a lot !

 

By the way, is there any way to report to the document author and update the 
document? I think it may be confused for a green hand just like me.

 

zha...@easemob.com

 

From: Ben Slater

Date: 2016-09-28 12:50

To: user

Subject: Re: Re: ask for help about exmples of Data Types the document shows

My best guess it that you need to remove the quotes from around the zip values 
(ie change if to  zip: 20500 rather than zip: ‘20500’ ) as zip is defined as an 
int. 

 

Cheers

Ben

 

On Wed, 28 Sep 2016 at 14:38 zha...@easemob.com  wrote:

Hi, Ben Slater, thank you very much for your replay!

 

my cassandra version is 3.7, so I think there must be some thing  I 
misunderstand  ahout frozen type. I add a comma between } and ‘work’, the 
result is like below. Is there some special form  about " type frozen"?

 

cqlsh:counterks> INSERT INTO user (name, addresses) VALUES ('z3 Pr3z1den7', 
{'home' : {street: '1600 Pennsylvania Ave NW',city: 'Washington',zip: 
'20500',phones: { 'cell' : { country_code: 1, number: '202 456-' 
},'landline' : { country_code: 1, number: '...' } }},'work' : {street: '1600 
Pennsylvania Ave NW',city: 'Washington',zip: '20500',phones: { 'fax' : { 
country_code: 1, number: '...' } }}});

InvalidRequest: code=2200 [Invalid query] message="Invalid map literal for 
addresses: value {city: 'Washington', zip: '20500', street: '1600 Pennsylvania 
Ave NW', phones: {'cell': {number: '202 456-', country_code: 1}, 
'landline': {number: '...', country_code: 1}}} is not of type frozen" 

 

my create statements about table and type are:

 

cqlsh:counterks> CREATE TYPE phone ( country_code int, number text, );

cqlsh:counterks> CREATE TYPE address ( street text, city text, zip 
int, phones map );
cqlsh:counterks> CREATE TABLE user (
 ... name text PRIMARY KEY,
 ... addresses map
 ... );

 

 

 

zha...@easemob.com

 

From: Ben Slater

Date: 2016-09-28 11:29

To: user

Subject: Re: ask for help about exmples of Data Types the document shows

Hi, 

 

I think you are right about the typo in (1). For (2), I think you’re missing a 
comma between } and ‘work’ so the JSON is invalid.

 

I think reading this JIRA https://issues.apache.org/jira/browse/CASSANDRA-7423 
that the change requiring  a UDT as part of a collection to be explicitly 
marked as frozen is relatively recent (3.6) so the doco may be out date there.

 

Cheers

Ben

 

On Wed, 28 Sep 2016 at 13:12 zha...@easemob.com  wrote:

hi, everyone, I'm learning Cassandra now , and have some problems about the 
document of "Data Types" .  I don't know where to report or ask for help, so 
I'm very sorry if this mail bother you.

 

In the chapter The Cassandra Query Language (CQL)/Data Types 
(http://cassandra.apache.org/doc/latest/cql/types.html), I'm confused with two 
examples the document showing below. My enviroment is:

 

CentOS release 6.8 (Final)

 

java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)

 

Python 2.7.11

 

Cassandra version: 3.7

CQL version: [cqlsh 5.0.1 | Cassandra 3.7 | CQL spec 3.4.2 | Native protocol v4]

 

 

1、 in http://cassandra.apache.org/doc/latest/cql/types.html, when describing 
type set, the giving example is:

CREATE TABLE images (
    name text PRIMARY KEY,
    owner text,
    tags set // A set of text values
);
INSERT INTO images (name, owner, tags)
    VALUES ('cat.jpg', 'jsmith', { 'pet', 'cute' });
// Replace the existing set entirely
UPDATE images SET tags = { 'kitten', 'cat', 'lol' } WHERE id = 'jsmith';
the update cql statement uses "WHERE id = 'jsmith'" while the table images did 
not define key "id". I think it's just a slip of the pen.

 

2、 in http://cassandra.apache.org/doc/latest/cql/types.html, when describing 
“User-Defined Types”,  the giving example is:

CREATE TYPE phone (

    country_code int,
    number text,
)
CREATE TYPE address (
    street text,
    city text,
    zip int,
    phones map
)
CREATE TABLE user (
    name text PRIMARY KEY,
    addresses map
)
and when I try to create type address, one error occur:

 

cqlsh:counterks> CREATE TYPE address (
 ... street text,
 ... city text,
 ... zip int,
 

Re: Re: ask for help about exmples of Data Types the document shows

2016-09-27 Thread zha...@easemob.com
hi, Ben, you are right, I copy the statement from document but not check it 
carefully. It's very helpful and thank a lot !

By the way, is there any way to report to the document author and update the 
document? I think it may be confused for a green hand just like me.



zha...@easemob.com
 
From: Ben Slater
Date: 2016-09-28 12:50
To: user
Subject: Re: Re: ask for help about exmples of Data Types the document shows
My best guess it that you need to remove the quotes from around the zip values 
(ie change if to  zip: 20500 rather than zip: ‘20500’ ) as zip is defined as an 
int.

Cheers
Ben

On Wed, 28 Sep 2016 at 14:38 zha...@easemob.com  wrote:
Hi, Ben Slater, thank you very much for your replay!

my cassandra version is 3.7, so I think there must be some thing  I 
misunderstand  ahout frozen type. I add a comma between } and ‘work’, the 
result is like below. Is there some special form  about " type frozen"?

cqlsh:counterks> INSERT INTO user (name, addresses) VALUES ('z3 Pr3z1den7', 
{'home' : {street: '1600 Pennsylvania Ave NW',city: 'Washington',zip: 
'20500',phones: { 'cell' : { country_code: 1, number: '202 456-' 
},'landline' : { country_code: 1, number: '...' } }},'work' : {street: '1600 
Pennsylvania Ave NW',city: 'Washington',zip: '20500',phones: { 'fax' : { 
country_code: 1, number: '...' } }}});
InvalidRequest: code=2200 [Invalid query] message="Invalid map literal for 
addresses: value {city: 'Washington', zip: '20500', street: '1600 Pennsylvania 
Ave NW', phones: {'cell': {number: '202 456-', country_code: 1}, 
'landline': {number: '...', country_code: 1}}} is not of type frozen" 

my create statements about table and type are:

cqlsh:counterks> CREATE TYPE phone ( country_code int, number text, );
cqlsh:counterks> CREATE TYPE address ( street text, city text, zip 
int, phones map );
cqlsh:counterks> CREATE TABLE user (
 ... name text PRIMARY KEY,
 ... addresses map
 ... );





zha...@easemob.com
 
From: Ben Slater
Date: 2016-09-28 11:29
To: user
Subject: Re: ask for help about exmples of Data Types the document shows
Hi,

I think you are right about the typo in (1). For (2), I think you’re missing a 
comma between } and ‘work’ so the JSON is invalid.

I think reading this JIRA https://issues.apache.org/jira/browse/CASSANDRA-7423 
that the change requiring  a UDT as part of a collection to be explicitly 
marked as frozen is relatively recent (3.6) so the doco may be out date there.

Cheers
Ben

On Wed, 28 Sep 2016 at 13:12 zha...@easemob.com  wrote:
hi, everyone, I'm learning Cassandra now , and have some problems about the 
document of "Data Types" .  I don't know where to report or ask for help, so 
I'm very sorry if this mail bother you.

In the chapter The Cassandra Query Language (CQL)/Data Types 
(http://cassandra.apache.org/doc/latest/cql/types.html), I'm confused with two 
examples the document showing below. My enviroment is:

CentOS release 6.8 (Final)

java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)

Python 2.7.11

Cassandra version: 3.7
CQL version: [cqlsh 5.0.1 | Cassandra 3.7 | CQL spec 3.4.2 | Native protocol v4]


1、 in http://cassandra.apache.org/doc/latest/cql/types.html, when describing 
type set, the giving example is:
CREATE TABLE images (
name text PRIMARY KEY,
owner text,
tags set // A set of text values
);
INSERT INTO images (name, owner, tags)
VALUES ('cat.jpg', 'jsmith', { 'pet', 'cute' });
// Replace the existing set entirely
UPDATE images SET tags = { 'kitten', 'cat', 'lol' } WHERE id = 'jsmith';
the update cql statement uses "WHERE id = 'jsmith'" while the table images did 
not define key "id". I think it's just a slip of the pen.

2、 in http://cassandra.apache.org/doc/latest/cql/types.html, when describing 
“User-Defined Types”,  the giving example is:
CREATE TYPE phone (
country_code int,
number text,
)
CREATE TYPE address (
street text,
city text,
zip int,
phones map
)
CREATE TABLE user (
name text PRIMARY KEY,
addresses map
)
and when I try to create type address, one error occur:

cqlsh:counterks> CREATE TYPE address (
 ... street text,
 ... city text,
 ... zip int,
 ... phones map
 ... );
InvalidRequest: code=2200 [Invalid query] message="Non-frozen UDTs are not 
allowed inside collections: map"

I change the create statement, like:

CREATE TYPE address (
street text,
city text,
zip int,
phones map
);

it works, and the create table user statement works well. Unfortunately, when 
running the insert statement below, error occur:
INSERT INTO user (name, addresses)
  VALUES ('z3 Pr3z1den7', {
 

Re: Re: ask for help about exmples of Data Types the document shows

2016-09-27 Thread Ben Slater
My best guess it that you need to remove the quotes from around the zip
values (ie change if to  zip: 20500 rather than zip: ‘20500’ ) as zip is
defined as an int.

Cheers
Ben

On Wed, 28 Sep 2016 at 14:38 zha...@easemob.com  wrote:

> Hi, Ben Slater, thank you very much for your replay!
>
> my cassandra version is 3.7, so I think there must be some thing  I
> misunderstand  ahout frozen type. I add a comma between } and ‘work’, the
> result is like below. Is there some special form  about " type frozen"?
>
>
> cqlsh:counterks> INSERT INTO user (name, addresses) VALUES ('z3 Pr3z1den7', 
> {'home' : {street: '1600 Pennsylvania Ave NW',city: 'Washington',zip: 
> '20500',phones: { 'cell' : { country_code: 1, number: '202 456-' 
> },'landline' : { country_code: 1, number: '...' } }},'work' : {street: '1600 
> Pennsylvania Ave NW',city: 'Washington',zip: '20500',phones: { 'fax' : { 
> country_code: 1, number: '...' } }}});
>
> InvalidRequest: code=2200 [Invalid query] message="Invalid map literal for 
> addresses: value {city: 'Washington', zip: '20500', street: '1600 
> Pennsylvania Ave NW', phones: {'cell': {number: '202 456-', country_code: 
> 1}, 'landline': {number: '...', country_code: 1}}} is not of type 
> frozen"
>
>
> my create statements about table and type are:
>
>
> cqlsh:counterks> CREATE TYPE phone ( country_code int, number text, );
>
> cqlsh:counterks> CREATE TYPE address ( street text, city text, 
> zip int, phones map );
> cqlsh:counterks> CREATE TABLE user (
>  ... name text PRIMARY KEY,
>  ... addresses map
>  ... );
>
>
>
> --
> zha...@easemob.com
>
>
> *From:* Ben Slater 
> *Date:* 2016-09-28 11:29
> *To:* user 
> *Subject:* Re: ask for help about exmples of Data Types the document shows
>
> Hi,
>
> I think you are right about the typo in (1). For (2), I think you’re
> missing a comma between } and ‘work’ so the JSON is invalid.
>
> I think reading this JIRA
> https://issues.apache.org/jira/browse/CASSANDRA-7423 that the change
> requiring  a UDT as part of a collection to be explicitly marked as frozen
> is relatively recent (3.6) so the doco may be out date there.
>
> Cheers
> Ben
>
> On Wed, 28 Sep 2016 at 13:12 zha...@easemob.com 
> wrote:
>
>> hi, everyone, I'm learning Cassandra now , and have some problems about
>> the document of "Data Types" .  I don't know where to report or ask for
>> help, so I'm very sorry if this mail bother you.
>>
>> In the chapter The Cassandra Query Language (CQL)/Data Types (
>> http://cassandra.apache.org/doc/latest/cql/types.html), I'm confused
>> with two examples the document showing below. My enviroment is:
>>
>> CentOS release 6.8 (Final)
>>
>> java version "1.8.0_91"
>> Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
>> Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)
>>
>> Python 2.7.11
>>
>> Cassandra version: 3.7
>> CQL version:
>> [cqlsh 5.0.1 | Cassandra 3.7 | CQL spec 3.4.2 | Native protocol v4]
>>
>>
>> 1、 in http://cassandra.apache.org/doc/latest/cql/types.html, when
>> describing type set, the giving example is:
>>
>> CREATE TABLE images (
>> name text PRIMARY KEY,
>> owner text,
>> tags set // A set of text values);INSERT INTO images (name, owner, 
>> tags)
>> VALUES ('cat.jpg', 'jsmith', { 'pet', 'cute' });// Replace the 
>> existing set entirelyUPDATE images SET tags = { 'kitten', 'cat', 'lol' } 
>> WHERE id = 'jsmith';
>>
>> the update cql statement uses "WHERE id = 'jsmith'" while the table
>> images did not define key "id". I think it's just a slip of the pen.
>>
>> 2、 in http://cassandra.apache.org/doc/latest/cql/types.html, when
>> describing “User-Defined Types”,  the giving example is:
>> CREATE TYPE phone (
>>
>> country_code int,
>> number text,)CREATE TYPE address (
>> street text,
>> city text,
>> zip int,
>> phones map)CREATE TABLE user (
>> name text PRIMARY KEY,
>> addresses map)
>>
>> and when I try to create type address, one error occur:
>>
>> cqlsh:counterks> CREATE TYPE address (
>>  ... street text,
>>  ... city text,
>>  ... zip int,
>>  ... phones map
>>  ... );
>>
>> InvalidRequest: code=2200 [Invalid query] message="Non-frozen UDTs are not 
>> allowed inside collections: map"
>>
>> I change the create statement, like:
>>
>> CREATE TYPE address (
>> street text,
>> city text,
>> zip int,
>> phones map
>> );
>>
>> it works, and the create table user statement works well. Unfortunately,
>> when running the insert statement below, error occur:
>>
>> INSERT INTO user (name, addresses)
>>   VALUES ('z3 Pr3z1den7', {
>>   'home' : {
>> 

Re: Re: ask for help about exmples of Data Types the document shows

2016-09-27 Thread zha...@easemob.com
Hi, Ben Slater, thank you very much for your replay!

my cassandra version is 3.7, so I think there must be some thing  I 
misunderstand  ahout frozen type. I add a comma between } and ‘work’, the 
result is like below. Is there some special form  about " type frozen"?

cqlsh:counterks> INSERT INTO user (name, addresses) VALUES ('z3 Pr3z1den7', 
{'home' : {street: '1600 Pennsylvania Ave NW',city: 'Washington',zip: 
'20500',phones: { 'cell' : { country_code: 1, number: '202 456-' 
},'landline' : { country_code: 1, number: '...' } }},'work' : {street: '1600 
Pennsylvania Ave NW',city: 'Washington',zip: '20500',phones: { 'fax' : { 
country_code: 1, number: '...' } }}});
InvalidRequest: code=2200 [Invalid query] message="Invalid map literal for 
addresses: value {city: 'Washington', zip: '20500', street: '1600 Pennsylvania 
Ave NW', phones: {'cell': {number: '202 456-', country_code: 1}, 
'landline': {number: '...', country_code: 1}}} is not of type frozen" 

my create statements about table and type are:

cqlsh:counterks> CREATE TYPE phone ( country_code int, number text, );
cqlsh:counterks> CREATE TYPE address ( street text, city text, zip 
int, phones map );
cqlsh:counterks> CREATE TABLE user (
 ... name text PRIMARY KEY,
 ... addresses map
 ... );





zha...@easemob.com
 
From: Ben Slater
Date: 2016-09-28 11:29
To: user
Subject: Re: ask for help about exmples of Data Types the document shows
Hi,

I think you are right about the typo in (1). For (2), I think you’re missing a 
comma between } and ‘work’ so the JSON is invalid.

I think reading this JIRA https://issues.apache.org/jira/browse/CASSANDRA-7423 
that the change requiring  a UDT as part of a collection to be explicitly 
marked as frozen is relatively recent (3.6) so the doco may be out date there.

Cheers
Ben

On Wed, 28 Sep 2016 at 13:12 zha...@easemob.com  wrote:
hi, everyone, I'm learning Cassandra now , and have some problems about the 
document of "Data Types" .  I don't know where to report or ask for help, so 
I'm very sorry if this mail bother you.

In the chapter The Cassandra Query Language (CQL)/Data Types 
(http://cassandra.apache.org/doc/latest/cql/types.html), I'm confused with two 
examples the document showing below. My enviroment is:

CentOS release 6.8 (Final)

java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)

Python 2.7.11

Cassandra version: 3.7
CQL version: [cqlsh 5.0.1 | Cassandra 3.7 | CQL spec 3.4.2 | Native protocol v4]


1、 in http://cassandra.apache.org/doc/latest/cql/types.html, when describing 
type set, the giving example is:
CREATE TABLE images (
name text PRIMARY KEY,
owner text,
tags set // A set of text values
);
INSERT INTO images (name, owner, tags)
VALUES ('cat.jpg', 'jsmith', { 'pet', 'cute' });
// Replace the existing set entirely
UPDATE images SET tags = { 'kitten', 'cat', 'lol' } WHERE id = 'jsmith';
the update cql statement uses "WHERE id = 'jsmith'" while the table images did 
not define key "id". I think it's just a slip of the pen.

2、 in http://cassandra.apache.org/doc/latest/cql/types.html, when describing 
“User-Defined Types”,  the giving example is:
CREATE TYPE phone (
country_code int,
number text,
)
CREATE TYPE address (
street text,
city text,
zip int,
phones map
)
CREATE TABLE user (
name text PRIMARY KEY,
addresses map
)
and when I try to create type address, one error occur:

cqlsh:counterks> CREATE TYPE address (
 ... street text,
 ... city text,
 ... zip int,
 ... phones map
 ... );
InvalidRequest: code=2200 [Invalid query] message="Non-frozen UDTs are not 
allowed inside collections: map"

I change the create statement, like:

CREATE TYPE address (
street text,
city text,
zip int,
phones map
);

it works, and the create table user statement works well. Unfortunately, when 
running the insert statement below, error occur:
INSERT INTO user (name, addresses)
  VALUES ('z3 Pr3z1den7', {
  'home' : {
  street: '1600 Pennsylvania Ave NW',
  city: 'Washington',
  zip: '20500',
  phones: { 'cell' : { country_code: 1, number: '202 456-' 
},
'landline' : { country_code: 1, number: '...' } }
  }
  'work' : {
  street: '1600 Pennsylvania Ave NW',
  city: 'Washington',
  zip: '20500',
  phones: { 'fax' : { country_code: 1, number: '...' } }
  }
  })
error:
SyntaxException: 

 Is the any suggestion about the problem 2?

Best wishes for everyone, thank you 

Re: ask for help about exmples of Data Types the document shows

2016-09-27 Thread Ben Slater
Hi,

I think you are right about the typo in (1). For (2), I think you’re
missing a comma between } and ‘work’ so the JSON is invalid.

I think reading this JIRA
https://issues.apache.org/jira/browse/CASSANDRA-7423 that the change
requiring  a UDT as part of a collection to be explicitly marked as frozen
is relatively recent (3.6) so the doco may be out date there.

Cheers
Ben

On Wed, 28 Sep 2016 at 13:12 zha...@easemob.com  wrote:

> hi, everyone, I'm learning Cassandra now , and have some problems about
> the document of "Data Types" .  I don't know where to report or ask for
> help, so I'm very sorry if this mail bother you.
>
> In the chapter The Cassandra Query Language (CQL)/Data Types (
> http://cassandra.apache.org/doc/latest/cql/types.html), I'm confused with
> two examples the document showing below. My enviroment is:
>
> CentOS release 6.8 (Final)
>
> java version "1.8.0_91"
> Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
> Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)
>
> Python 2.7.11
>
> Cassandra version: 3.7
> CQL version:
> [cqlsh 5.0.1 | Cassandra 3.7 | CQL spec 3.4.2 | Native protocol v4]
>
>
> 1、 in http://cassandra.apache.org/doc/latest/cql/types.html, when
> describing type set, the giving example is:
>
> CREATE TABLE images (
> name text PRIMARY KEY,
> owner text,
> tags set // A set of text values);INSERT INTO images (name, owner, 
> tags)
> VALUES ('cat.jpg', 'jsmith', { 'pet', 'cute' });// Replace the 
> existing set entirelyUPDATE images SET tags = { 'kitten', 'cat', 'lol' } 
> WHERE id = 'jsmith';
>
> the update cql statement uses "WHERE id = 'jsmith'" while the table
> images did not define key "id". I think it's just a slip of the pen.
>
> 2、 in http://cassandra.apache.org/doc/latest/cql/types.html, when
> describing “User-Defined Types”,  the giving example is:
> CREATE TYPE phone (
>
> country_code int,
> number text,)CREATE TYPE address (
> street text,
> city text,
> zip int,
> phones map)CREATE TABLE user (
> name text PRIMARY KEY,
> addresses map)
>
> and when I try to create type address, one error occur:
>
> cqlsh:counterks> CREATE TYPE address (
>  ... street text,
>  ... city text,
>  ... zip int,
>  ... phones map
>  ... );
>
> InvalidRequest: code=2200 [Invalid query] message="Non-frozen UDTs are not 
> allowed inside collections: map"
>
> I change the create statement, like:
>
> CREATE TYPE address (
> street text,
> city text,
> zip int,
> phones map
> );
>
> it works, and the create table user statement works well. Unfortunately,
> when running the insert statement below, error occur:
>
> INSERT INTO user (name, addresses)
>   VALUES ('z3 Pr3z1den7', {
>   'home' : {
>   street: '1600 Pennsylvania Ave NW',
>   city: 'Washington',
>   zip: '20500',
>   phones: { 'cell' : { country_code: 1, number: '202 
> 456-' },
> 'landline' : { country_code: 1, number: '...' } }
>   }
>   'work' : {
>   street: '1600 Pennsylvania Ave NW',
>   city: 'Washington',
>   zip: '20500',
>   phones: { 'fax' : { country_code: 1, number: '...' } }
>   }
>   })
>
> error:
>
> SyntaxException:  message="line 10:14 mismatched input 'work' expecting '}' (...: '...' } } 
>  }  ['wor]k' :...)">
>
>  Is the any suggestion about the problem 2?
>
> Best wishes for everyone, thank you for your watching !
>
> --
> zha...@easemob.com
>
-- 

Ben Slater
Chief Product Officer
Instaclustr: Cassandra + Spark - Managed | Consulting | Support
+61 437 929 798


ask for help about exmples of Data Types the document shows

2016-09-27 Thread zha...@easemob.com
hi, everyone, I'm learning Cassandra now , and have some problems about the 
document of "Data Types" .  I don't know where to report or ask for help, so 
I'm very sorry if this mail bother you.

In the chapter The Cassandra Query Language (CQL)/Data Types 
(http://cassandra.apache.org/doc/latest/cql/types.html), I'm confused with two 
examples the document showing below. My enviroment is:

CentOS release 6.8 (Final)

java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)

Python 2.7.11

Cassandra version: 3.7
CQL version: [cqlsh 5.0.1 | Cassandra 3.7 | CQL spec 3.4.2 | Native protocol v4]


1、 in http://cassandra.apache.org/doc/latest/cql/types.html, when describing 
type set, the giving example is:
CREATE TABLE images (
name text PRIMARY KEY,
owner text,
tags set // A set of text values
);
INSERT INTO images (name, owner, tags)
VALUES ('cat.jpg', 'jsmith', { 'pet', 'cute' });
// Replace the existing set entirely
UPDATE images SET tags = { 'kitten', 'cat', 'lol' } WHERE id = 'jsmith';
the update cql statement uses "WHERE id = 'jsmith'" while the table images did 
not define key "id". I think it's just a slip of the pen.

2、 in http://cassandra.apache.org/doc/latest/cql/types.html, when describing 
“User-Defined Types”,  the giving example is:
CREATE TYPE phone (
country_code int,
number text,
)
CREATE TYPE address (
street text,
city text,
zip int,
phones map
)
CREATE TABLE user (
name text PRIMARY KEY,
addresses map
)
and when I try to create type address, one error occur:

cqlsh:counterks> CREATE TYPE address (
 ... street text,
 ... city text,
 ... zip int,
 ... phones map
 ... );
InvalidRequest: code=2200 [Invalid query] message="Non-frozen UDTs are not 
allowed inside collections: map"

I change the create statement, like:

CREATE TYPE address (
street text,
city text,
zip int,
phones map
);

it works, and the create table user statement works well. Unfortunately, when 
running the insert statement below, error occur:
INSERT INTO user (name, addresses)
  VALUES ('z3 Pr3z1den7', {
  'home' : {
  street: '1600 Pennsylvania Ave NW',
  city: 'Washington',
  zip: '20500',
  phones: { 'cell' : { country_code: 1, number: '202 456-' 
},
'landline' : { country_code: 1, number: '...' } }
  }
  'work' : {
  street: '1600 Pennsylvania Ave NW',
  city: 'Washington',
  zip: '20500',
  phones: { 'fax' : { country_code: 1, number: '...' } }
  }
  })
error:
SyntaxException: 

 Is the any suggestion about the problem 2?

Best wishes for everyone, thank you for your watching !



zha...@easemob.com