[ 
https://issues.apache.org/jira/browse/CASSANDRA-8473?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14252538#comment-14252538
 ] 

Tyler Hobbs commented on CASSANDRA-8473:
----------------------------------------

Thanks! The changes look good, so I think this is ready to commit.

bq. Before we close this question, can you give us a sense of what your 
concerns are and how we might address them?

Sure.  I think your implementation is sound and the new tests are good. My main 
concern is regressions in related parts of the codebase (single-column 
relations, index creation, indexes on collections).  We do have test coverage 
for these areas, but of course it's very difficult to have perfect coverage.   
My secondary, lesser concern is putting out a (moderately complex) new feature 
without a beta testing period.

By default, we strongly prefer to reserve new features for "major" releases 
(x.y.0).  In practice, this depends on the complexity, isolation, and value of 
the feature, but we're trying to be more strict about this.  Lots of seemingly 
safe patches have unforeseen consequences.  In a database, most users prefer 
stability in bugfix releases over getting new features, so we prioritize 
stability.

With that said, I really appreciate you contributing a great patch for this 
feature.  Not everybody takes the time to write tests and get the details right 
:).   I'm sorry about not being able to merge this in to 2.1, but we should be 
releasing 3.0 in the Spring, so hopefully you won't have to run a patched 
version for too long.

> Secondary index support for key-value pairs in CQL3 maps
> --------------------------------------------------------
>
>                 Key: CASSANDRA-8473
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-8473
>             Project: Cassandra
>          Issue Type: Improvement
>            Reporter: Samuel Klock
>            Assignee: Samuel Klock
>             Fix For: 3.0
>
>         Attachments: cassandra-2.1-8473-actual-v1.txt, 
> cassandra-2.1-8473-v2.txt, cassandra-2.1-8473-v3.txt, cassandra-2.1-8473.txt, 
> trunk-8473-v2.txt, trunk-8473-v3.txt
>
>
> CASSANDRA-4511 and CASSANDRA-6383 made substantial progress on secondary 
> indexes on CQL3 maps, but support for a natural use case is still missing: 
> queries to find rows with map columns containing some key-value pair.  For 
> example (from a comment on CASSANDRA-4511):
> {code:sql}
> SELECT * FROM main.users WHERE notify['email'] = true;
> {code}
> Cassandra should add support for this kind of index.  One option is to expose 
> a CQL interface like the following:
> * Creating an index:
> {code:sql}
> cqlsh:mykeyspace> CREATE TABLE mytable (key TEXT PRIMARY KEY, value MAP<TEXT, 
> TEXT>);
> cqlsh:mykeyspace> CREATE INDEX ON mytable(ENTRIES(value));
> {code}
> * Querying the index:
> {code:sql}
> cqlsh:mykeyspace> INSERT INTO mytable (key, value) VALUES ('foo', {'a': '1', 
> 'b': '2', 'c': '3'});
> cqlsh:mykeyspace> INSERT INTO mytable (key, value) VALUES ('bar', {'a': '1', 
> 'b': '4'});
> cqlsh:mykeyspace> INSERT INTO mytable (key, value) VALUES ('baz', {'b': '4', 
> 'c': '3'});
> cqlsh:mykeyspace> SELECT * FROM mytable WHERE value['a'] = '1';
>  key | value
> -----+--------------------------------
>  bar |           {'a': '1', 'b': '4'}
>  foo | {'a': '1', 'b': '2', 'c': '3'}
> (2 rows)
> cqlsh:mykeyspace> SELECT * FROM mytable WHERE value['a'] = '1' AND value['b'] 
> = '2' ALLOW FILTERING;
>  key | value
> -----+--------------------------------
>  foo | {'a': '1', 'b': '2', 'c': '3'}
> (1 rows)
> cqlsh:mykeyspace> SELECT * FROM mytable WHERE value['b'] = '2' ALLOW 
> FILTERING;
>  key | value                         
> -----+--------------------------------
>  foo | {'a': '1', 'b': '2', 'c': '3'}
> (1 rows)                             
> cqlsh:mykeyspace> SELECT * FROM mytable WHERE value['b'] = '4';
>  key | value
> -----+----------------------
>  bar | {'a': '1', 'b': '4'}
>  baz | {'b': '4', 'c': '3'}
> (2 rows)
> {code}
> A patch against the Cassandra-2.1 branch that implements this interface will 
> be attached to this issue shortly.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to