You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cassandra.apache.org by Jonathan Ellis <jb...@gmail.com> on 2014/10/13 07:15:08 UTC

Re: Cassandra Views

On Mon, Oct 6, 2014 at 5:18 PM, Tilmann Rabl <ti...@utoronto.ca>
wrote:

> I have a question related to Cassandra views. With a student, I have
> implemented a materialized views for Cassandra in version 2.0. The student
> left and I am trying to upgrade his code to the current version. I have
> noticed that the way keys are internally built has changed a bit.
>
> Our old version has used CFMetaData.comparator.getString(Colum.name) to
> get the name of a column (and the value) and that was then used to specify
> column names in the view. We used CFMetaData.comparator.fromString to
> generate the ByteBuffer representation.
> It seems the new Composite representation should be able to do that in a
> more efficient way (e.g., combine column names and keys), but I could not
> figure out how to do it.


That is a good question.  This was introduced in CASSANDRA-5147, and
there's a number of examples in the tests where we converted from the old
getString approach (e.g. Util.cellname methods) but in general I'm a little
fuzzy on how this works.  Sylvain, do we have a writeup on this anywhere?

-- 
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder, http://www.datastax.com
@spyced

Re: Cassandra Views

Posted by Sylvain Lebresne <sy...@datastax.com>.
On Mon, Oct 13, 2014 at 7:15 AM, Jonathan Ellis <jb...@gmail.com> wrote:

> On Mon, Oct 6, 2014 at 5:18 PM, Tilmann Rabl <ti...@utoronto.ca>
> wrote:
>
> > Our old version has used CFMetaData.comparator.getString(Colum.name) to
> > get the name of a column (and the value) and that was then used to
> specify
> > column names in the view. We used CFMetaData.comparator.fromString to
> > generate the ByteBuffer representation.
> > It seems the new Composite representation should be able to do that in a
> > more efficient way (e.g., combine column names and keys), but I could not
> > figure out how to do it.
>

I'm not exactly sure what you mean by "combine column names and keys" tbh,
mind precising? I mean, you can get a ByteBuffer from a Composite through
the toByteBuffer() method, which would allows you to use
CFMetaData.comparator.getString as before, but I'm not sure this is what
you're asking for.


> That is a good question.  This was introduced in CASSANDRA-5147,


And by that you mean CASSANDRA-5417 :)


> and there's a number of examples in the tests where we converted from the
> old
> getString approach (e.g. Util.cellname methods) but in general I'm a little
> fuzzy on how this works.  Sylvain, do we have a writeup on this anywhere?
>

Well, the code is really the best of writeups :). But outside some comments
on the
ticket and the code/comments, no, we don't really have other write-ups on
this.

--
Sylvain