You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Christof Roduner <ch...@scandit.com> on 2012/08/03 10:56:10 UTC

Changing comparator

Hi,

I know that changing a CF's comparator is not officially supported. 
However, there is a post by Jonathan Ellis that implies it can be done 
(www.mail-archive.com/user@cassandra.apache.org/msg09502.html).

I assume that we'd have to change entries in the system.schema_* column 
families.

Has anyone successfully done this?

We want to change the comparator from BytesType to UTF8Type to make the 
move to CQL easier ("cannot parse 'foo' as hex bytes"). Our CFs were 
created back in the Cassandra 0.6.x days and are too large to be easily 
copied to new CFs with a new schema.

Many thanks in advance.

Christof

Re: Changing comparator

Posted by Roshni Rajagopal <Ro...@wal-mart.com>.
Christof,

Am not convinced you need to change your comparator. Bytestype works for
most sorting even text ones.
Did you mean validator- for a column's value. Comparator is for column
ordering (ORDER BY in sql).

I believe you can just convert the text you want to search for to bytes
and then put it in where clause

"Bytes type should just be done via BytesTypeSerializer (a no-op

really) as a value " ... where value=raw bytes here"
"

Quoted from 
https://groups.google.com/forum/?fromgroups#!topic/hector-users/BpaemK95sPo


Disclaimer - I have not used this. It just seems an unnecessary thing to
do - to convert your validator/comparator from the default BytesType. My
understanding is that comparator for the column family can be BytesType
unless you want a specific Order By like TimeUUID.
And validators can be left as BytesType  unless you want some specific
validation that the value you are storing is a number or a time etc.







Regards,
Roshni

On 03/08/12 5:36 PM, "Christof Roduner" <ch...@scandit.com> wrote:

>Hi Roshni,
>
>Thanks for your reply. As far as I know, ASSUME is only for cqlsh and
>not for CQL in general. (We can of course achieve the same by
>programmatically setting the encoding. It would be just simpler to let
>the CQL driver take care of it...)
>
>Regards,
>Christof
>
>
>On 8/3/2012 11:31 AM, Roshni Rajagopal wrote:
>> Christof ,
>>
>> can't you just use ASSUME for the CQL session?
>>
>> http://www.datastax.com/docs/1.0/references/cql/ASSUME
>>
>>
>> Regards,
>> Roshni
>>
>>
>>
>> On 03/08/12 2:26 PM, "Christof Roduner" <ch...@scandit.com> wrote:
>>
>>> Hi,
>>>
>>> I know that changing a CF's comparator is not officially supported.
>>> However, there is a post by Jonathan Ellis that implies it can be done
>>> (www.mail-archive.com/user@cassandra.apache.org/msg09502.html).
>>>
>>> I assume that we'd have to change entries in the system.schema_* column
>>> families.
>>>
>>> Has anyone successfully done this?
>>>
>>> We want to change the comparator from BytesType to UTF8Type to make the
>>> move to CQL easier ("cannot parse 'foo' as hex bytes"). Our CFs were
>>> created back in the Cassandra 0.6.x days and are too large to be easily
>>> copied to new CFs with a new schema.
>>>
>>> Many thanks in advance.
>>>
>>> Christof
>>
>> This email and any files transmitted with it are confidential and
>>intended solely for the individual or entity to whom they are addressed.
>>If you have received this email in error destroy it immediately. ***
>>Walmart Confidential ***
>>

This email and any files transmitted with it are confidential and intended solely for the individual or entity to whom they are addressed. If you have received this email in error destroy it immediately. *** Walmart Confidential ***

Re: Changing comparator

Posted by Christof Roduner <ch...@scandit.com>.
Hi Roshni,

Thanks for your reply. As far as I know, ASSUME is only for cqlsh and 
not for CQL in general. (We can of course achieve the same by 
programmatically setting the encoding. It would be just simpler to let 
the CQL driver take care of it...)

Regards,
Christof


On 8/3/2012 11:31 AM, Roshni Rajagopal wrote:
> Christof ,
>
> can't you just use ASSUME for the CQL session?
>
> http://www.datastax.com/docs/1.0/references/cql/ASSUME
>
>
> Regards,
> Roshni
>
>
>
> On 03/08/12 2:26 PM, "Christof Roduner" <ch...@scandit.com> wrote:
>
>> Hi,
>>
>> I know that changing a CF's comparator is not officially supported.
>> However, there is a post by Jonathan Ellis that implies it can be done
>> (www.mail-archive.com/user@cassandra.apache.org/msg09502.html).
>>
>> I assume that we'd have to change entries in the system.schema_* column
>> families.
>>
>> Has anyone successfully done this?
>>
>> We want to change the comparator from BytesType to UTF8Type to make the
>> move to CQL easier ("cannot parse 'foo' as hex bytes"). Our CFs were
>> created back in the Cassandra 0.6.x days and are too large to be easily
>> copied to new CFs with a new schema.
>>
>> Many thanks in advance.
>>
>> Christof
>
> This email and any files transmitted with it are confidential and intended solely for the individual or entity to whom they are addressed. If you have received this email in error destroy it immediately. *** Walmart Confidential ***
>

Re: Changing comparator

Posted by Roshni Rajagopal <Ro...@wal-mart.com>.
Christof ,

can't you just use ASSUME for the CQL session?

http://www.datastax.com/docs/1.0/references/cql/ASSUME


Regards,
Roshni



On 03/08/12 2:26 PM, "Christof Roduner" <ch...@scandit.com> wrote:

>Hi,
>
>I know that changing a CF's comparator is not officially supported.
>However, there is a post by Jonathan Ellis that implies it can be done
>(www.mail-archive.com/user@cassandra.apache.org/msg09502.html).
>
>I assume that we'd have to change entries in the system.schema_* column
>families.
>
>Has anyone successfully done this?
>
>We want to change the comparator from BytesType to UTF8Type to make the
>move to CQL easier ("cannot parse 'foo' as hex bytes"). Our CFs were
>created back in the Cassandra 0.6.x days and are too large to be easily
>copied to new CFs with a new schema.
>
>Many thanks in advance.
>
>Christof

This email and any files transmitted with it are confidential and intended solely for the individual or entity to whom they are addressed. If you have received this email in error destroy it immediately. *** Walmart Confidential ***