inserting a row with a map column when using if not exists results in null column for the row

2013-09-25 Thread Joe Stein
Hi, was not sure if there is a reason for this or I am doing something
wrong or is known issue or not but when trying to insert a row with a map
collection column and using if not exist the map is coming out as null :(
see below, let me know, thanks!

cqlsh:rvag> CREATE TABLE users (
... id text PRIMARY KEY,
... given text,
... surname text,
... favs map   // A map of text keys, and text
values
... );
cqlsh:rvag> INSERT INTO users (id, given, surname, favs)
...VALUES ('jsmith', 'John', 'Smith', { 'fruit' :
'apple', 'band' : 'Beatles' });
cqlsh:rvag> select * from users;

 id | favs  | given | surname
+---+---+-
 jsmith | {'band': 'Beatles', 'fruit': 'apple'} |  John |   Smith

(1 rows)

cqlsh:rvag> truncate users;
cqlsh:rvag> select * from users;

(0 rows)

cqlsh:rvag> INSERT INTO users (id, given, surname, favs)
...VALUES ('jsmith', 'John', 'Smith', { 'fruit' :
'apple', 'band' : 'Beatles' }) IF NOT EXISTS;
cqlsh:rvag> select * from users;

 id | favs | given | surname
+--+---+-
 jsmith | null |  John |   Smith

(1 rows)

/***
 Joe Stein
 Founder, Principal Consultant
 Big Data Open Source Security LLC
 http://www.stealth.ly
 Twitter: @allthingshadoop 
/


Re: inserting a row with a map column when using if not exists results in null column for the row

2013-09-25 Thread Yuki Morishita
Sounds like https://issues.apache.org/jira/browse/CASSANDRA-6069

On Wed, Sep 25, 2013 at 8:29 PM, Joe Stein  wrote:
> Hi, was not sure if there is a reason for this or I am doing something
> wrong or is known issue or not but when trying to insert a row with a map
> collection column and using if not exist the map is coming out as null :(
> see below, let me know, thanks!
>
> cqlsh:rvag> CREATE TABLE users (
> ... id text PRIMARY KEY,
> ... given text,
> ... surname text,
> ... favs map   // A map of text keys, and text
> values
> ... );
> cqlsh:rvag> INSERT INTO users (id, given, surname, favs)
> ...VALUES ('jsmith', 'John', 'Smith', { 'fruit' :
> 'apple', 'band' : 'Beatles' });
> cqlsh:rvag> select * from users;
>
>  id | favs  | given | surname
> +---+---+-
>  jsmith | {'band': 'Beatles', 'fruit': 'apple'} |  John |   Smith
>
> (1 rows)
>
> cqlsh:rvag> truncate users;
> cqlsh:rvag> select * from users;
>
> (0 rows)
>
> cqlsh:rvag> INSERT INTO users (id, given, surname, favs)
> ...VALUES ('jsmith', 'John', 'Smith', { 'fruit' :
> 'apple', 'band' : 'Beatles' }) IF NOT EXISTS;
> cqlsh:rvag> select * from users;
>
>  id | favs | given | surname
> +--+---+-
>  jsmith | null |  John |   Smith
>
> (1 rows)
>
> /***
>  Joe Stein
>  Founder, Principal Consultant
>  Big Data Open Source Security LLC
>  http://www.stealth.ly
>  Twitter: @allthingshadoop 
> /



-- 
Yuki Morishita
 t:yukim (http://twitter.com/yukim)


Re: inserting a row with a map column when using if not exists results in null column for the row

2013-09-25 Thread Joe Stein
yup, thats it :) cool, thanks!

On Wed, Sep 25, 2013 at 9:42 PM, Yuki Morishita  wrote:

> Sounds like https://issues.apache.org/jira/browse/CASSANDRA-6069
>
> On Wed, Sep 25, 2013 at 8:29 PM, Joe Stein  wrote:
> > Hi, was not sure if there is a reason for this or I am doing something
> > wrong or is known issue or not but when trying to insert a row with a map
> > collection column and using if not exist the map is coming out as null :(
> > see below, let me know, thanks!
> >
> > cqlsh:rvag> CREATE TABLE users (
> > ... id text PRIMARY KEY,
> > ... given text,
> > ... surname text,
> > ... favs map   // A map of text keys, and text
> > values
> > ... );
> > cqlsh:rvag> INSERT INTO users (id, given, surname, favs)
> > ...VALUES ('jsmith', 'John', 'Smith', { 'fruit' :
> > 'apple', 'band' : 'Beatles' });
> > cqlsh:rvag> select * from users;
> >
> >  id | favs  | given | surname
> > +---+---+-
> >  jsmith | {'band': 'Beatles', 'fruit': 'apple'} |  John |   Smith
> >
> > (1 rows)
> >
> > cqlsh:rvag> truncate users;
> > cqlsh:rvag> select * from users;
> >
> > (0 rows)
> >
> > cqlsh:rvag> INSERT INTO users (id, given, surname, favs)
> > ...VALUES ('jsmith', 'John', 'Smith', { 'fruit' :
> > 'apple', 'band' : 'Beatles' }) IF NOT EXISTS;
> > cqlsh:rvag> select * from users;
> >
> >  id | favs | given | surname
> > +--+---+-
> >  jsmith | null |  John |   Smith
> >
> > (1 rows)
> >
> > /***
> >  Joe Stein
> >  Founder, Principal Consultant
> >  Big Data Open Source Security LLC
> >  http://www.stealth.ly
> >  Twitter: @allthingshadoop 
> > /
>
>
>
> --
> Yuki Morishita
>  t:yukim (http://twitter.com/yukim)
>