You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Sasha Dolgy <sd...@gmail.com> on 2011/04/18 09:23:11 UTC

predefining columns

Hi all,

When defining a new column family, there is the possiblity to define
columns.  I see the benefit in defining the columns when I want to
explicitly define that a secondary index will be created on that
column.  I also see the benefit of predefining the type of that column
if it will differ from the default for the column family (byte versus
utf8 for example).

If none of these scenarios are needed, is there any benefit gained by
pre-defining the columns in a CF when creating the column family
initially?

-sd

-- 
Sasha Dolgy
sasha.dolgy@gmail.com

Re: predefining columns

Posted by aaron morton <aa...@thelastpickle.com>.
if it's not set it will be the BytesTypes where validation is a no-op. 

IMHO best to keep that validation in your app.

Aaron 

On 19 Apr 2011, at 01:30, Sasha Dolgy wrote:

> So, in the instance of a simple CF for user data:
> 
> username
> fullname
> birthdate
> 
> If birthdate is unix timestamp, it wont need the UTF8 validator.  The
> other 2 columns could.  Does this then mean that a default should
> -not- be set for the column family?
> 
> -sd
> 
> On Mon, Apr 18, 2011 at 3:27 PM, Jonathan Ellis <jb...@gmail.com> wrote:
>> No.
>> 
>> But, it is not recommended to mix default_validation_class and column
>> definitions. If you have a relatively static set of columns, column
>> definitions are recommended.


Re: predefining columns

Posted by Sasha Dolgy <sd...@gmail.com>.
So, in the instance of a simple CF for user data:

username
fullname
birthdate

If birthdate is unix timestamp, it wont need the UTF8 validator.  The
other 2 columns could.  Does this then mean that a default should
-not- be set for the column family?

-sd

On Mon, Apr 18, 2011 at 3:27 PM, Jonathan Ellis <jb...@gmail.com> wrote:
> No.
>
> But, it is not recommended to mix default_validation_class and column
> definitions. If you have a relatively static set of columns, column
> definitions are recommended.

Re: predefining columns

Posted by Jonathan Ellis <jb...@gmail.com>.
No.

But, it is not recommended to mix default_validation_class and column
definitions. If you have a relatively static set of columns, column
definitions are recommended.

On Mon, Apr 18, 2011 at 2:23 AM, Sasha Dolgy <sd...@gmail.com> wrote:
> Hi all,
>
> When defining a new column family, there is the possiblity to define
> columns.  I see the benefit in defining the columns when I want to
> explicitly define that a secondary index will be created on that
> column.  I also see the benefit of predefining the type of that column
> if it will differ from the default for the column family (byte versus
> utf8 for example).
>
> If none of these scenarios are needed, is there any benefit gained by
> pre-defining the columns in a CF when creating the column family
> initially?
>
> -sd
>
> --
> Sasha Dolgy
> sasha.dolgy@gmail.com
>



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