Re: Thrift composite partition key to cql migration

2016-03-31 Thread Tyler Hobbs
Also, can you paste the results of the relevant portions of "SELECT * FROM
system.schema_columns" and "SELECT * FROM system.schema_columnfamilies"?

On Thu, Mar 31, 2016 at 2:35 PM, Tyler Hobbs  wrote:

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



-- 
Tyler Hobbs
DataStax 


Re: Thrift composite partition key to cql migration

2016-03-31 Thread Tyler Hobbs
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  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 


Thrift composite partition key to cql migration

2016-03-30 Thread Jan Kesten

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