You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Sylvain Lebresne (Created) (JIRA)" <ji...@apache.org> on 2012/01/25 19:02:49 UTC

[jira] [Created] (CASSANDRA-3782) Secondary indexes support for wide rows in CQL 3.0

Secondary indexes support for wide rows in CQL 3.0
--------------------------------------------------

                 Key: CASSANDRA-3782
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-3782
             Project: Cassandra
          Issue Type: Sub-task
            Reporter: Sylvain Lebresne
            Assignee: Sylvain Lebresne


Currently, CQL 3.0 doesn't allow creating an index on a dynamic CF (with COMPACT STORAGE). The goal of this ticket is *not* to support the composite case however (CASSANDRA-3680 will tackle this).

I think changes needed to support this are only in the CQL side and covert two area:
* Finding a syntax for it
* Currently, the CQL 3 code consider that a CF with any column_metadata defined is a non-compact cf. Basically the problem is that we currently use column_metadata both for defining a name for a column in the static case, and store indexing information. Ideally, we would separate those informations, i.e. we could add a new map valueAliases (ByteBuffer -> AbstractType) to CFMetadata (only used by static CF) and we would keep column_metadata for indexing purpose only. However that may be problematic for backward compatibility (with thrift in particular), so probably instead we can just add a new boolean isStaticColumnName to ColumnDefinition.

--
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

        

[jira] [Commented] (CASSANDRA-3782) Secondary indexes support for wide rows in CQL 3.0

Posted by "Sylvain Lebresne (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-3782?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13202560#comment-13202560 ] 

Sylvain Lebresne commented on CASSANDRA-3782:
---------------------------------------------

bq. I think it may be confusing that the user would need to specify values for exactly each part of the PK declaration

I suppose that's more a problem for CASSANDRA-3680. But actually it may be worth dealing with this at the same time we deal with CASSANDRA-3680. I initially wanted to separate the two issues because for non-composite wide rows we wouldn't really need to change anything to secondary indexes to support this. But now I'm a bit afraid that we'll do something here that is not coherent with CASSANDRA-3680.
                
> Secondary indexes support for wide rows in CQL 3.0
> --------------------------------------------------
>
>                 Key: CASSANDRA-3782
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-3782
>             Project: Cassandra
>          Issue Type: Sub-task
>          Components: API
>            Reporter: Sylvain Lebresne
>            Assignee: Sylvain Lebresne
>             Fix For: 1.1
>
>
> Currently, CQL 3.0 doesn't allow creating an index on a dynamic CF (with COMPACT STORAGE). The goal of this ticket is *not* to support the composite case however (CASSANDRA-3680 will tackle this).
> I think changes needed to support this are only in the CQL side and covert two area:
> * Finding a syntax for it
> * Currently, the CQL 3 code consider that a CF with any column_metadata defined is a non-compact cf. Basically the problem is that we currently use column_metadata both for defining a name for a column in the static case, and store indexing information. Ideally, we would separate those informations, i.e. we could add a new map valueAliases (ByteBuffer -> AbstractType) to CFMetadata (only used by static CF) and we would keep column_metadata for indexing purpose only. However that may be problematic for backward compatibility (with thrift in particular), so probably instead we can just add a new boolean isStaticColumnName to ColumnDefinition.

--
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

        

[jira] [Commented] (CASSANDRA-3782) Secondary indexes support for wide rows in CQL 3.0

Posted by "Sylvain Lebresne (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-3782?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13195596#comment-13195596 ] 

Sylvain Lebresne commented on CASSANDRA-3782:
---------------------------------------------

I'll refer to the following comment on CASSANDRA-3761:
https://issues.apache.org/jira/browse/CASSANDRA-3761?focusedCommentId=13191984&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13191984

I fully agree my example is not particularly clear in that you can wonder why you would do that indexing. I really only picked it to illustrate the proposed syntax.

So in the comment above, Thorsten gives two examples of using a secondary index (the ones we have right now) for a wide row. As he is himself admitting, it's abusing a bit the column name, basically creating a column with a fixed name in a wide row just for the purpose of re-using the secondary index mechanism to find rows based on some criteria. Of course, we could decide whether we want to disallow this on purpose, but I don't see a very good reason to do that since it's not a lot of work, at least someone cares about it and both thrift and CQL 2.0 allows it.
                
> Secondary indexes support for wide rows in CQL 3.0
> --------------------------------------------------
>
>                 Key: CASSANDRA-3782
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-3782
>             Project: Cassandra
>          Issue Type: Sub-task
>          Components: API
>            Reporter: Sylvain Lebresne
>            Assignee: Sylvain Lebresne
>             Fix For: 1.1
>
>
> Currently, CQL 3.0 doesn't allow creating an index on a dynamic CF (with COMPACT STORAGE). The goal of this ticket is *not* to support the composite case however (CASSANDRA-3680 will tackle this).
> I think changes needed to support this are only in the CQL side and covert two area:
> * Finding a syntax for it
> * Currently, the CQL 3 code consider that a CF with any column_metadata defined is a non-compact cf. Basically the problem is that we currently use column_metadata both for defining a name for a column in the static case, and store indexing information. Ideally, we would separate those informations, i.e. we could add a new map valueAliases (ByteBuffer -> AbstractType) to CFMetadata (only used by static CF) and we would keep column_metadata for indexing purpose only. However that may be problematic for backward compatibility (with thrift in particular), so probably instead we can just add a new boolean isStaticColumnName to ColumnDefinition.

--
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

        

[jira] [Commented] (CASSANDRA-3782) Secondary indexes support for wide rows in CQL 3.0

Posted by "Jonathan Ellis (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-3782?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13195224#comment-13195224 ] 

Jonathan Ellis commented on CASSANDRA-3782:
-------------------------------------------

I'm confused by this example.  First, because in this case time is a "simple" column name so it's part of the row's "column index."  I don't see what additional indexes would buy us.  While I could see creating indexes on subordinate parts of a composite column name, I imagine that's what CASSANDRA-3680 has in mind.  So in my mind the "index wide rows" part that's distinct from "index composite columns" is, "index the values part of wide row columns," i.e., event in this example.

The other reason I'm confused is because the general case is people want to index everything in a column; while partial indexes (http://www.postgresql.org/docs/9.1/static/indexes-partial.html) can certainly be useful, it's more of an "advanced" feature (MySQL doesn't support it at all).
                
> Secondary indexes support for wide rows in CQL 3.0
> --------------------------------------------------
>
>                 Key: CASSANDRA-3782
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-3782
>             Project: Cassandra
>          Issue Type: Sub-task
>          Components: API
>            Reporter: Sylvain Lebresne
>            Assignee: Sylvain Lebresne
>             Fix For: 1.1
>
>
> Currently, CQL 3.0 doesn't allow creating an index on a dynamic CF (with COMPACT STORAGE). The goal of this ticket is *not* to support the composite case however (CASSANDRA-3680 will tackle this).
> I think changes needed to support this are only in the CQL side and covert two area:
> * Finding a syntax for it
> * Currently, the CQL 3 code consider that a CF with any column_metadata defined is a non-compact cf. Basically the problem is that we currently use column_metadata both for defining a name for a column in the static case, and store indexing information. Ideally, we would separate those informations, i.e. we could add a new map valueAliases (ByteBuffer -> AbstractType) to CFMetadata (only used by static CF) and we would keep column_metadata for indexing purpose only. However that may be problematic for backward compatibility (with thrift in particular), so probably instead we can just add a new boolean isStaticColumnName to ColumnDefinition.

--
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

        

[jira] [Commented] (CASSANDRA-3782) Secondary indexes support for wide rows in CQL 3.0

Posted by "Jonathan Ellis (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-3782?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13198000#comment-13198000 ] 

Jonathan Ellis commented on CASSANDRA-3782:
-------------------------------------------

I see.  That makes sense, although I think it may be confusing that the user would need to specify values for exactly each part of the PK declaration.
                
> Secondary indexes support for wide rows in CQL 3.0
> --------------------------------------------------
>
>                 Key: CASSANDRA-3782
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-3782
>             Project: Cassandra
>          Issue Type: Sub-task
>          Components: API
>            Reporter: Sylvain Lebresne
>            Assignee: Sylvain Lebresne
>             Fix For: 1.1
>
>
> Currently, CQL 3.0 doesn't allow creating an index on a dynamic CF (with COMPACT STORAGE). The goal of this ticket is *not* to support the composite case however (CASSANDRA-3680 will tackle this).
> I think changes needed to support this are only in the CQL side and covert two area:
> * Finding a syntax for it
> * Currently, the CQL 3 code consider that a CF with any column_metadata defined is a non-compact cf. Basically the problem is that we currently use column_metadata both for defining a name for a column in the static case, and store indexing information. Ideally, we would separate those informations, i.e. we could add a new map valueAliases (ByteBuffer -> AbstractType) to CFMetadata (only used by static CF) and we would keep column_metadata for indexing purpose only. However that may be problematic for backward compatibility (with thrift in particular), so probably instead we can just add a new boolean isStaticColumnName to ColumnDefinition.

--
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

        

[jira] [Commented] (CASSANDRA-3782) Secondary indexes support for wide rows in CQL 3.0

Posted by "Sylvain Lebresne (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-3782?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13193179#comment-13193179 ] 

Sylvain Lebresne commented on CASSANDRA-3782:
---------------------------------------------

For the syntax, let's consider a typical dynamic CF in CQL 3.0:
{noformat}
CREATE TABLE timeline (
  key int,
  time timestamp,
  event text,
  PRIMARY KEY (key, time)
) WITH COMPACT STORAGE
{noformat}

then a syntax to declare an index could look like:
{noformat}
CREATE INDEX index_name ON timeline WHERE time = 0;
{noformat}
Alternatively, we could have it be:
{noformat}
CREATE INDEX index_name ON timeline(0);
{noformat}
but I feel that will be less intuitive.

There is obviously a lot of possible variation. Maybe it could be worth keeping CASSANDRA-3680 in mind too for this.
                
> Secondary indexes support for wide rows in CQL 3.0
> --------------------------------------------------
>
>                 Key: CASSANDRA-3782
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-3782
>             Project: Cassandra
>          Issue Type: Sub-task
>          Components: API
>            Reporter: Sylvain Lebresne
>            Assignee: Sylvain Lebresne
>             Fix For: 1.1
>
>
> Currently, CQL 3.0 doesn't allow creating an index on a dynamic CF (with COMPACT STORAGE). The goal of this ticket is *not* to support the composite case however (CASSANDRA-3680 will tackle this).
> I think changes needed to support this are only in the CQL side and covert two area:
> * Finding a syntax for it
> * Currently, the CQL 3 code consider that a CF with any column_metadata defined is a non-compact cf. Basically the problem is that we currently use column_metadata both for defining a name for a column in the static case, and store indexing information. Ideally, we would separate those informations, i.e. we could add a new map valueAliases (ByteBuffer -> AbstractType) to CFMetadata (only used by static CF) and we would keep column_metadata for indexing purpose only. However that may be problematic for backward compatibility (with thrift in particular), so probably instead we can just add a new boolean isStaticColumnName to ColumnDefinition.

--
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