cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tyler Hobbs <ty...@datastax.com>
Subject Re: Thrift composite partition key to cql migration
Date Thu, 31 Mar 2016 19:35:49 GMT
In the Thrift schema, is the key_validation_class actually set to
CompositeType(UTF8Type, UTF8Type), or is it just BytesType?  What Cassandra
version?

On Wed, Mar 30, 2016 at 4:44 PM, Jan Kesten <j.kesten@enercast.de> wrote:

> Hi,
>
> while migrating the reminder of thrift operations in my application I came
> across a point where I cant find a good hint.
>
> In our old code we used a composite with two strings as row / partition
> key and a similar composite as column key like this:
>
>     public Composite rowKey() {
>         final Composite composite = new Composite();
>         composite.addComponent(key1, StringSerializer.get());
>         composite.addComponent(key2, StringSerializer.get());
>         return composite;
>     }
>
>     public Composite columnKey() {
>         final Composite composite = new Composite();
>         composite.addComponent(key3, StringSerializer.get());
>         composite.addComponent(key4, StringSerializer.get());
>         return composite;
>     }
>
> In cql this columnfamiliy looks like this:
>
> CREATE TABLE foo.bar (
>     key blob,
>     column1 text,
>     column2 text,
>     value blob,
>     PRIMARY KEY (key, column1, column2)
> )
>
> For the columns key3 and key4 became column1 and column2 - but the old
> rowkey is presented as blob (I can put it into a hex editor and see that
> key1 and key2 values are in there).
>
> Any pointers to handle this or is this a known issue? I am using now
> DataStax Java driver for CQL, old connector used thrift. Is there any way
> to get key1 and key2 back apart from completly rewriting the table? This is
> what I had expected it to be:
>
> CREATE TABLE foo.bar (
>     key1 text,
>     key2 text,
>     column1 text,
>     column2 text,
>     value blob,
>     PRIMARY KEY ((key1, key2), column1, column2)
> )
>
> Cheers,
> Jan
>



-- 
Tyler Hobbs
DataStax <http://datastax.com/>

Mime
View raw message