You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Vedarth Kulkarni <ve...@gmail.com> on 2011/02/02 21:48:46 UTC

how to change compare_with

Hello there,

I am using Cassandra 0.7. Is there any way to change the 'compare_with' from
my program ?, I am using Hector and I am programming in Java.

OR

Is it possible to change it from the bin/cassandra-cli ?

Please explain me in detail if possible or suggest me a good resource on the
internet.

Vedarth Kulkarni,
TYBSc (Computer Science).

Re: how to change compare_with

Posted by Vedarth Kulkarni <ve...@gmail.com>.
Thank you.

I got it from the examples provided by Hector.

Vedarth Kulkarni,
TYBSc (Computer Science).



On Thu, Feb 3, 2011 at 6:22 AM, Jonathan Ellis <jb...@gmail.com> wrote:

> Correct.  But with more and more clients being able to do intelligent
> things based on metadata it's not just decoration.  (UTF8Type,
> LexicalUUIDType, BytesType, and AsciiType all have the same ordering.
> I believe IntegerType and LongType are equivalent orderings as well.)
>
> On Wed, Feb 2, 2011 at 3:35 PM, Stu Hood <st...@gmail.com> wrote:
> > Not only does the type need to make sense, but it also needs to sort in
> > exactly the same order as the previous type did... in which case there
> would
> > be no reason to change it?
> > We should probably just say "no, you cannot do this", and explicitly
> prevent
> > it.
> >
> > On Wed, Feb 2, 2011 at 3:14 PM, Jonathan Ellis <jb...@gmail.com>
> wrote:
> >>
> >> On Wed, Feb 2, 2011 at 3:01 PM, Tyler Hobbs <ty...@datastax.com> wrote:
> >> > I think Jonathan mispoke.
> >>
> >> I thought I was mistaken, but I was wrong. :)
> >>
> >> > You cannot change the 'compare_with' attribute of an existing column
> >> > family.
> >>
> >> You can, but it's up to you to make sure that the new type makes
> >> sense.  Most frequently, you see this when changing from BytesType to
> >> something more structured.
> >>
> >> (If you screw up and specify a compare_with that is nonsensical for
> >> your data, just change it back.)
> >>
> >> --
> >> Jonathan Ellis
> >> Project Chair, Apache Cassandra
> >> co-founder of DataStax, the source for professional Cassandra support
> >> http://www.datastax.com
> >
> >
>
>
>
> --
> Jonathan Ellis
> Project Chair, Apache Cassandra
> co-founder of DataStax, the source for professional Cassandra support
> http://www.datastax.com
>

Re: how to change compare_with

Posted by Jonathan Ellis <jb...@gmail.com>.
Correct.  But with more and more clients being able to do intelligent
things based on metadata it's not just decoration.  (UTF8Type,
LexicalUUIDType, BytesType, and AsciiType all have the same ordering.
I believe IntegerType and LongType are equivalent orderings as well.)

On Wed, Feb 2, 2011 at 3:35 PM, Stu Hood <st...@gmail.com> wrote:
> Not only does the type need to make sense, but it also needs to sort in
> exactly the same order as the previous type did... in which case there would
> be no reason to change it?
> We should probably just say "no, you cannot do this", and explicitly prevent
> it.
>
> On Wed, Feb 2, 2011 at 3:14 PM, Jonathan Ellis <jb...@gmail.com> wrote:
>>
>> On Wed, Feb 2, 2011 at 3:01 PM, Tyler Hobbs <ty...@datastax.com> wrote:
>> > I think Jonathan mispoke.
>>
>> I thought I was mistaken, but I was wrong. :)
>>
>> > You cannot change the 'compare_with' attribute of an existing column
>> > family.
>>
>> You can, but it's up to you to make sure that the new type makes
>> sense.  Most frequently, you see this when changing from BytesType to
>> something more structured.
>>
>> (If you screw up and specify a compare_with that is nonsensical for
>> your data, just change it back.)
>>
>> --
>> Jonathan Ellis
>> Project Chair, Apache Cassandra
>> co-founder of DataStax, the source for professional Cassandra support
>> http://www.datastax.com
>
>



-- 
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of DataStax, the source for professional Cassandra support
http://www.datastax.com

Re: how to change compare_with

Posted by Stu Hood <st...@gmail.com>.
Not only does the type need to make sense, but it also needs to sort in
exactly the same order as the previous type did... in which case there would
be no reason to change it?

We should probably just say "no, you cannot do this", and explicitly prevent
it.

On Wed, Feb 2, 2011 at 3:14 PM, Jonathan Ellis <jb...@gmail.com> wrote:

> On Wed, Feb 2, 2011 at 3:01 PM, Tyler Hobbs <ty...@datastax.com> wrote:
> > I think Jonathan mispoke.
>
> I thought I was mistaken, but I was wrong. :)
>
> > You cannot change the 'compare_with' attribute of an existing column
> > family.
>
> You can, but it's up to you to make sure that the new type makes
> sense.  Most frequently, you see this when changing from BytesType to
> something more structured.
>
> (If you screw up and specify a compare_with that is nonsensical for
> your data, just change it back.)
>
> --
> Jonathan Ellis
> Project Chair, Apache Cassandra
> co-founder of DataStax, the source for professional Cassandra support
> http://www.datastax.com
>

Re: how to change compare_with

Posted by Jonathan Ellis <jb...@gmail.com>.
On Wed, Feb 2, 2011 at 3:01 PM, Tyler Hobbs <ty...@datastax.com> wrote:
> I think Jonathan mispoke.

I thought I was mistaken, but I was wrong. :)

> You cannot change the 'compare_with' attribute of an existing column
> family.

You can, but it's up to you to make sure that the new type makes
sense.  Most frequently, you see this when changing from BytesType to
something more structured.

(If you screw up and specify a compare_with that is nonsensical for
your data, just change it back.)

-- 
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of DataStax, the source for professional Cassandra support
http://www.datastax.com

Re: how to change compare_with

Posted by Tyler Hobbs <ty...@datastax.com>.
I think Jonathan mispoke.

You cannot change the 'compare_with' attribute of an existing column
family.  The solution is to create a new column family with the data type
that you need.

See 'help create column family;'

-- 
Tyler Hobbs
Software Engineer, DataStax <http://datastax.com/>
Maintainer of the pycassa <http://github.com/pycassa/pycassa> Cassandra
Python client library

Re: how to change compare_with

Posted by Vedarth Kulkarni <ve...@gmail.com>.
I tried "help update column family".
It gave me :

*valid attributes are:
    - column_type: Super or Standard
    - comment: Human-readable column family description. Any string is
acceptable
    - rows_cached: Number or percentage of rows to cache
    - row_cache_save_period: Period with which to persist the row cache, in
seconds
    - keys_cached: Number or percentage of keys to cache
    - key_cache_save_period: Period with which to persist the key cache, in
seconds
    - read_repair_chance: Probability (0.0-1.0) with which to perform read
repairs on CL.ONE reads
    - gc_grace: Discard tombstones after this many seconds
    - column_metadata: null
    - memtable_operations: Flush memtables after this many operations
    - memtable_throughput: ... or after this many bytes have been written
    - memtable_flush_after: ... or after this many seconds
    - default_validation_class: null
    - min_compaction_threshold: Avoid minor compactions of less than this
number of sstable files
    - max_compaction_threshold: Compact no more than this number of sstable
files at once
    - column_metadata: Metadata which describes columns of column family.
        Supported format is [{ k:v, k:v, ... }, { ... }, ...]
        Valid attributes: column_name, validation_class (see comparator),
                          index_type (integer), index_name.

*So what is to be used ?
And also if possible please provide information on how do that in Java using
Hector.
Thank you.


Vedarth Kulkarni,
TYBSc (Computer Science).



On Thu, Feb 3, 2011 at 2:58 AM, Jonathan Ellis <jb...@gmail.com> wrote:

> On Wed, Feb 2, 2011 at 12:48 PM, Vedarth Kulkarni <ve...@gmail.com>
> wrote:
> > Hello there,
> >
> > I am using Cassandra 0.7. Is there any way to change the 'compare_with'
> from
> > my program ?, I am using Hector and I am programming in Java.
>
> Yes.
>
> > Is it possible to change it from the bin/cassandra-cli ?
>
> Yes.  "help update column family;"
>
> --
> Jonathan Ellis
> Project Chair, Apache Cassandra
> co-founder of DataStax, the source for professional Cassandra support
> http://www.datastax.com
>

Re: how to change compare_with

Posted by Jonathan Ellis <jb...@gmail.com>.
On Wed, Feb 2, 2011 at 12:48 PM, Vedarth Kulkarni <ve...@gmail.com> wrote:
> Hello there,
>
> I am using Cassandra 0.7. Is there any way to change the 'compare_with' from
> my program ?, I am using Hector and I am programming in Java.

Yes.

> Is it possible to change it from the bin/cassandra-cli ?

Yes.  "help update column family;"

-- 
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of DataStax, the source for professional Cassandra support
http://www.datastax.com