[jira] [Updated] (CASSANDRA-3783) Add 'null' support to CQL 3.0

2013-04-04 Thread Aleksey Yeschenko (JIRA)

 [ 
https://issues.apache.org/jira/browse/CASSANDRA-3783?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Aleksey Yeschenko updated CASSANDRA-3783:
-

Reviewer: iamaleksey

 Add 'null' support to CQL 3.0
 -

 Key: CASSANDRA-3783
 URL: https://issues.apache.org/jira/browse/CASSANDRA-3783
 Project: Cassandra
  Issue Type: Sub-task
  Components: API
Reporter: Sylvain Lebresne
Assignee: Michał Michalski
Priority: Minor
  Labels: cql3
 Fix For: 1.2.4

 Attachments: 3783-v2.patch, 3783-v3.patch, 3783-v4.txt, 
 3783-wip-v1.patch


 Dense composite supports adding records where only a prefix of all the 
 component specifying the key is defined. In other words, with:
 {noformat}
 CREATE TABLE connections (
userid int,
ip text,
port int,
protocol text,
time timestamp,
PRIMARY KEY (userid, ip, port, protocol)
 ) WITH COMPACT STORAGE
 {noformat}
 you can insert
 {noformat}
 INSERT INTO connections (userid, ip, port, time) VALUES (2, '192.168.0.1', 
 80, 123456789);
 {noformat}
 You cannot however select that column specifically (i.e, without selecting 
 column (2, '192.168.0.1', 80, 'http') for instance).
 This ticket proposes to allow that though 'null', i.e. to allow
 {noformat}
 SELECT * FROM connections WHERE userid = 2 AND ip = '192.168.0.1' AND port = 
 80 AND protocol = null;
 {noformat}
 It would then also make sense to support:
 {noformat}
 INSERT INTO connections (userid, ip, port, protocol, time) VALUES (2, 
 '192.168.0.1', 80, null, 123456789);
 {noformat}
 as an equivalent to the insert query above.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Updated] (CASSANDRA-3783) Add 'null' support to CQL 3.0

2013-04-04 Thread Aleksey Yeschenko (JIRA)

 [ 
https://issues.apache.org/jira/browse/CASSANDRA-3783?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Aleksey Yeschenko updated CASSANDRA-3783:
-

Attachment: 3783-v5.txt

 Add 'null' support to CQL 3.0
 -

 Key: CASSANDRA-3783
 URL: https://issues.apache.org/jira/browse/CASSANDRA-3783
 Project: Cassandra
  Issue Type: Sub-task
  Components: API
Reporter: Sylvain Lebresne
Assignee: Michał Michalski
Priority: Minor
  Labels: cql3
 Fix For: 1.2.4

 Attachments: 3783-v2.patch, 3783-v3.patch, 3783-v4.txt, 3783-v5.txt, 
 3783-wip-v1.patch


 Dense composite supports adding records where only a prefix of all the 
 component specifying the key is defined. In other words, with:
 {noformat}
 CREATE TABLE connections (
userid int,
ip text,
port int,
protocol text,
time timestamp,
PRIMARY KEY (userid, ip, port, protocol)
 ) WITH COMPACT STORAGE
 {noformat}
 you can insert
 {noformat}
 INSERT INTO connections (userid, ip, port, time) VALUES (2, '192.168.0.1', 
 80, 123456789);
 {noformat}
 You cannot however select that column specifically (i.e, without selecting 
 column (2, '192.168.0.1', 80, 'http') for instance).
 This ticket proposes to allow that though 'null', i.e. to allow
 {noformat}
 SELECT * FROM connections WHERE userid = 2 AND ip = '192.168.0.1' AND port = 
 80 AND protocol = null;
 {noformat}
 It would then also make sense to support:
 {noformat}
 INSERT INTO connections (userid, ip, port, protocol, time) VALUES (2, 
 '192.168.0.1', 80, null, 123456789);
 {noformat}
 as an equivalent to the insert query above.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Updated] (CASSANDRA-3783) Add 'null' support to CQL 3.0

2013-03-21 Thread Sylvain Lebresne (JIRA)

 [ 
https://issues.apache.org/jira/browse/CASSANDRA-3783?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sylvain Lebresne updated CASSANDRA-3783:


Attachment: 3783-v4.txt

Sorry I wasn't clear, what I meant earlier is that CASSANDRA-5081 already has 
the tests needed to handle null. Typically, the test the patch adds to 
Operation is already in Constants.Setter and related collection methods (the 
goal being to have the same code to handle prepared and non-prepared statement).

So attaching a v4 that reuse the code introduced by CASSANDRA-5081. It makes 
{{null}} a separate object rather than another constant because that felt 
slightly cleaner/simpler). Also, in the parser, {{null}} is a 'value' instead 
of 'constant': the difference is minor but it avoid having to deal with 
{{null}} in CREATE/ALTER property values (since they are 'constant').

The patch also validate that null values are not used inside a collection and 
simplify/fix a few collections methods.


 Add 'null' support to CQL 3.0
 -

 Key: CASSANDRA-3783
 URL: https://issues.apache.org/jira/browse/CASSANDRA-3783
 Project: Cassandra
  Issue Type: Sub-task
  Components: API
Reporter: Sylvain Lebresne
Assignee: Michał Michalski
Priority: Minor
  Labels: cql3
 Fix For: 1.2.4

 Attachments: 3783-v2.patch, 3783-v3.patch, 3783-v4.txt, 
 3783-wip-v1.patch


 Dense composite supports adding records where only a prefix of all the 
 component specifying the key is defined. In other words, with:
 {noformat}
 CREATE TABLE connections (
userid int,
ip text,
port int,
protocol text,
time timestamp,
PRIMARY KEY (userid, ip, port, protocol)
 ) WITH COMPACT STORAGE
 {noformat}
 you can insert
 {noformat}
 INSERT INTO connections (userid, ip, port, time) VALUES (2, '192.168.0.1', 
 80, 123456789);
 {noformat}
 You cannot however select that column specifically (i.e, without selecting 
 column (2, '192.168.0.1', 80, 'http') for instance).
 This ticket proposes to allow that though 'null', i.e. to allow
 {noformat}
 SELECT * FROM connections WHERE userid = 2 AND ip = '192.168.0.1' AND port = 
 80 AND protocol = null;
 {noformat}
 It would then also make sense to support:
 {noformat}
 INSERT INTO connections (userid, ip, port, protocol, time) VALUES (2, 
 '192.168.0.1', 80, null, 123456789);
 {noformat}
 as an equivalent to the insert query above.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Updated] (CASSANDRA-3783) Add 'null' support to CQL 3.0

2013-02-25 Thread Sylvain Lebresne (JIRA)

 [ 
https://issues.apache.org/jira/browse/CASSANDRA-3783?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sylvain Lebresne updated CASSANDRA-3783:


Fix Version/s: (was: 1.2.2)
   1.2.3

 Add 'null' support to CQL 3.0
 -

 Key: CASSANDRA-3783
 URL: https://issues.apache.org/jira/browse/CASSANDRA-3783
 Project: Cassandra
  Issue Type: Sub-task
  Components: API
Reporter: Sylvain Lebresne
Assignee: Michał Michalski
Priority: Minor
  Labels: cql3
 Fix For: 1.2.3

 Attachments: 3783-v2.patch, 3783-wip-v1.patch


 Dense composite supports adding records where only a prefix of all the 
 component specifying the key is defined. In other words, with:
 {noformat}
 CREATE TABLE connections (
userid int,
ip text,
port int,
protocol text,
time timestamp,
PRIMARY KEY (userid, ip, port, protocol)
 ) WITH COMPACT STORAGE
 {noformat}
 you can insert
 {noformat}
 INSERT INTO connections (userid, ip, port, time) VALUES (2, '192.168.0.1', 
 80, 123456789);
 {noformat}
 You cannot however select that column specifically (i.e, without selecting 
 column (2, '192.168.0.1', 80, 'http') for instance).
 This ticket proposes to allow that though 'null', i.e. to allow
 {noformat}
 SELECT * FROM connections WHERE userid = 2 AND ip = '192.168.0.1' AND port = 
 80 AND protocol = null;
 {noformat}
 It would then also make sense to support:
 {noformat}
 INSERT INTO connections (userid, ip, port, protocol, time) VALUES (2, 
 '192.168.0.1', 80, null, 123456789);
 {noformat}
 as an equivalent to the insert query above.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Updated] (CASSANDRA-3783) Add 'null' support to CQL 3.0

2013-02-20 Thread JIRA

 [ 
https://issues.apache.org/jira/browse/CASSANDRA-3783?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Michał Michalski updated CASSANDRA-3783:


Attachment: 3783-v2.patch

OK, here's the patch. In general I've added possibility to check TYPE of 
classes implementing Term.Raw and use it in Operations classes implementing 
RawUpdate (one of them, actually). If Term Type is NULL, return 
Constants.Deleter Operation when preparing operation.

Quick explaination:

Why, among all the classes containing nested Literal classes implementing 
Term.Raw, only one checks for Term Type and rest of them return false by 
default?
* Constants: it checks the Type because, obviously, this is the main null-value 
use case
* Sets, Lists, Maps: If one of them is set to null it's matched (by parser) as 
a null-based Constant (which seems to be fine from my point of view, doesn't 
it?), so none of them can be of type null itself
* TypeCast, FunctionCall, AbstractMarker: it just doesn't make sense for them 
to be null

Why only SetValue (among other RawUpdate interfaces) checks if Term is NULL and 
returns Deleter if yes:
* RawUpdate:
SetValue: obviously, this was the main use case here
SetElement: setting collections' values to null might make sense, but do we 
want it?
Addition, Substraction, Prepend: adding null to existing column's contents 
etc. doesn't make sense for me
* RawDeletion: If we do not support nulls in SELECTs because of the indexing 
reasons, I guess it can't be done in DELETEs too


 Add 'null' support to CQL 3.0
 -

 Key: CASSANDRA-3783
 URL: https://issues.apache.org/jira/browse/CASSANDRA-3783
 Project: Cassandra
  Issue Type: Sub-task
  Components: API
Reporter: Sylvain Lebresne
Priority: Minor
  Labels: cql3
 Fix For: 1.2.2

 Attachments: 3783-v2.patch, 3783-wip-v1.patch


 Dense composite supports adding records where only a prefix of all the 
 component specifying the key is defined. In other words, with:
 {noformat}
 CREATE TABLE connections (
userid int,
ip text,
port int,
protocol text,
time timestamp,
PRIMARY KEY (userid, ip, port, protocol)
 ) WITH COMPACT STORAGE
 {noformat}
 you can insert
 {noformat}
 INSERT INTO connections (userid, ip, port, time) VALUES (2, '192.168.0.1', 
 80, 123456789);
 {noformat}
 You cannot however select that column specifically (i.e, without selecting 
 column (2, '192.168.0.1', 80, 'http') for instance).
 This ticket proposes to allow that though 'null', i.e. to allow
 {noformat}
 SELECT * FROM connections WHERE userid = 2 AND ip = '192.168.0.1' AND port = 
 80 AND protocol = null;
 {noformat}
 It would then also make sense to support:
 {noformat}
 INSERT INTO connections (userid, ip, port, protocol, time) VALUES (2, 
 '192.168.0.1', 80, null, 123456789);
 {noformat}
 as an equivalent to the insert query above.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Updated] (CASSANDRA-3783) Add 'null' support to CQL 3.0

2013-02-10 Thread JIRA

 [ 
https://issues.apache.org/jira/browse/CASSANDRA-3783?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Michał Michalski updated CASSANDRA-3783:


Attachment: 3783-wip-v1.patch

I started to investigate this problem a bit and I easily came to the point 
where I can pass null in cql3sh - see attached work-in-progress patch. It even 
ends up with proper INSERT (proper means that it shows up as red colored 
null in cqlsh when performing SELECT ;-) ) for all fields of Type that returns 
EMPTY_BYTE_BUFFER in fromString method, as I pass  to Literal constructor. 
However, this simply cannot work with strings, as  will be saved as . 
Anyway, before I try to push this problem further, I have some questions:

1. Is this (see attachment), in general, a good way to go with this task? Or 
maybe I'm completely wrong with this approach?

2. How about string-based Types? We obviously can't return EMPTY_BYTE_BUFFER 
for  because it's a valid string, so I was thinking about a solution that 
will handle literal 'null' value as a second param for Literal class 
constructor, which could be then handled (by simple 'if') in all db.marshall 
types to return EMPTY_BYTE_BUFFER. It doesn't look like a perfect solution to 
me, but it looks _quite_ clean and... well... it's the best idea I had so far 
;-)

Any other thoughts on this? 


 Add 'null' support to CQL 3.0
 -

 Key: CASSANDRA-3783
 URL: https://issues.apache.org/jira/browse/CASSANDRA-3783
 Project: Cassandra
  Issue Type: Sub-task
  Components: API
Reporter: Sylvain Lebresne
Priority: Minor
  Labels: cql3
 Fix For: 1.2.2

 Attachments: 3783-wip-v1.patch


 Dense composite supports adding records where only a prefix of all the 
 component specifying the key is defined. In other words, with:
 {noformat}
 CREATE TABLE connections (
userid int,
ip text,
port int,
protocol text,
time timestamp,
PRIMARY KEY (userid, ip, port, protocol)
 ) WITH COMPACT STORAGE
 {noformat}
 you can insert
 {noformat}
 INSERT INTO connections (userid, ip, port, time) VALUES (2, '192.168.0.1', 
 80, 123456789);
 {noformat}
 You cannot however select that column specifically (i.e, without selecting 
 column (2, '192.168.0.1', 80, 'http') for instance).
 This ticket proposes to allow that though 'null', i.e. to allow
 {noformat}
 SELECT * FROM connections WHERE userid = 2 AND ip = '192.168.0.1' AND port = 
 80 AND protocol = null;
 {noformat}
 It would then also make sense to support:
 {noformat}
 INSERT INTO connections (userid, ip, port, protocol, time) VALUES (2, 
 '192.168.0.1', 80, null, 123456789);
 {noformat}
 as an equivalent to the insert query above.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Updated] (CASSANDRA-3783) Add 'null' support to CQL 3.0

2012-08-16 Thread Jonathan Ellis (JIRA)

 [ 
https://issues.apache.org/jira/browse/CASSANDRA-3783?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jonathan Ellis updated CASSANDRA-3783:
--

Fix Version/s: (was: 1.2.0)
   1.2.1

 Add 'null' support to CQL 3.0
 -

 Key: CASSANDRA-3783
 URL: https://issues.apache.org/jira/browse/CASSANDRA-3783
 Project: Cassandra
  Issue Type: Sub-task
  Components: API
Reporter: Sylvain Lebresne
Priority: Minor
  Labels: cql3
 Fix For: 1.2.1


 Dense composite supports adding records where only a prefix of all the 
 component specifying the key is defined. In other words, with:
 {noformat}
 CREATE TABLE connections (
userid int,
ip text,
port int,
protocol text,
time timestamp,
PRIMARY KEY (userid, ip, port, protocol)
 ) WITH COMPACT STORAGE
 {noformat}
 you can insert
 {noformat}
 INSERT INTO connections (userid, ip, port, time) VALUES (2, '192.168.0.1', 
 80, 123456789);
 {noformat}
 You cannot however select that column specifically (i.e, without selecting 
 column (2, '192.168.0.1', 80, 'http') for instance).
 This ticket proposes to allow that though 'null', i.e. to allow
 {noformat}
 SELECT * FROM connections WHERE userid = 2 AND ip = '192.168.0.1' AND port = 
 80 AND protocol = null;
 {noformat}
 It would then also make sense to support:
 {noformat}
 INSERT INTO connections (userid, ip, port, protocol, time) VALUES (2, 
 '192.168.0.1', 80, null, 123456789);
 {noformat}
 as an equivalent to the insert query above.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira