nguyen khac tu | 25 Jun 2012 09:17
Picon

cannot insert composite key

hi all

i have a column family AllLog create that

create column family LogData
  with column_type = 'Standard'
  and comparator = 'CompositeType(org.apache.cassandra.db.marshal.UTF8Type,org.apache.cassandra.db.marshal.UTF8Type)'
  and default_validation_class = 'UTF8Type'
  and key_validation_class = 'CompositeType(UTF8Type,UTF8Type)';

but when i use mutator to insert :

        String key0 = "key0";
        String key1 = "key1";

        Composite compositeKey = new Composite();
        compositeKey.addComponent(key0, StringSerializer.get());
        compositeKey.addComponent(key1, StringSerializer.get());

        // add
        mutator.addInsertion(compositeKey, columnFamilyName, HFactory.createColumn("name", "value"));
        mutator.execute();

always through exception:

me.prettyprint.hector.api.exceptions.HInvalidRequestException: InvalidRequestException(why:Not enough bytes to read value of component 0)

please some one help me, where is my mistake in this code :( ??????????

thanks all






Nate McCall | 25 Jun 2012 17:27
Picon
Gravatar

Re: cannot insert composite key

You have declared the column name to have the same type of comparator
as the key validation class.

The composite key is constructed correctly the column is not. The name
is a single string were it should be a composite constructed similarly
to the key (or change the default_comparator to a non-composite UTF8).

On Mon, Jun 25, 2012 at 2:17 AM, nguyen khac tu <tubcvt@...> wrote:
> hi all
> i have a column family AllLog create that
>
> create column family LogData
>   with column_type = 'Standard'
>   and comparator =
> 'CompositeType(org.apache.cassandra.db.marshal.UTF8Type,org.apache.cassandra.db.marshal.UTF8Type)'
>   and default_validation_class = 'UTF8Type'
>   and key_validation_class = 'CompositeType(UTF8Type,UTF8Type)';
>
> but when i use mutator to insert :
>
>         String key0 = "key0";
>         String key1 = "key1";
>
>         Composite compositeKey = new Composite();
>         compositeKey.addComponent(key0, StringSerializer.get());
>         compositeKey.addComponent(key1, StringSerializer.get());
>
>         // add
>         mutator.addInsertion(compositeKey, columnFamilyName,
> HFactory.createColumn("name", "value"));
>         mutator.execute();
>
> always through exception:
>
> me.prettyprint.hector.api.exceptions.HInvalidRequestException:
> InvalidRequestException(why:Not enough bytes to read value of component 0)
>
> please some one help me, where is my mistake in this code :( ??????????
>
> thanks all
>
>
>
>
>
>

Patricio Echagüe | 25 Jun 2012 17:52
Picon
Gravatar

Re: cannot insert composite key

Is there any reason to definethe composite differently?

Not sure if that is the issue but I would recommend using the short version in both places.

On Jun 25, 2012 8:27 AM, "Nate McCall" <zznate.m-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
You have declared the column name to have the same type of comparator
as the key validation class.

The composite key is constructed correctly the column is not. The name
is a single string were it should be a composite constructed similarly
to the key (or change the default_comparator to a non-composite UTF8).

On Mon, Jun 25, 2012 at 2:17 AM, nguyen khac tu <tubcvt-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> hi all
> i have a column family AllLog create that
>
> create column family LogData
>   with column_type = 'Standard'
>   and comparator =
> 'CompositeType(org.apache.cassandra.db.marshal.UTF8Type,org.apache.cassandra.db.marshal.UTF8Type)'
>   and default_validation_class = 'UTF8Type'
>   and key_validation_class = 'CompositeType(UTF8Type,UTF8Type)';
>
> but when i use mutator to insert :
>
>         String key0 = "key0";
>         String key1 = "key1";
>
>         Composite compositeKey = new Composite();
>         compositeKey.addComponent(key0, StringSerializer.get());
>         compositeKey.addComponent(key1, StringSerializer.get());
>
>         // add
>         mutator.addInsertion(compositeKey, columnFamilyName,
> HFactory.createColumn("name", "value"));
>         mutator.execute();
>
> always through exception:
>
> me.prettyprint.hector.api.exceptions.HInvalidRequestException:
> InvalidRequestException(why:Not enough bytes to read value of component 0)
>
> please some one help me, where is my mistake in this code :( ??????????
>
> thanks all
>
>
>
>
>
>
nguyen khac tu | 25 Jun 2012 18:03
Picon

Re: cannot insert composite key

thanks for helping me ,, I think  i 'm wrong when set  comparator  ="composite" 


but when i changed columnfamily logdata to :


CREATE TABLE logdata (
  time text,
  lineid text,
  value text,
  PRIMARY KEY (time, lineid)
) WITH
  comment='' AND
  caching='KEYS_ONLY' AND
  read_repair_chance=0.100000 AND
  gc_grace_seconds=864000 AND
  min_compaction_threshold=4 AND
  max_compaction_threshold=32 AND
  replicate_on_write='true' AND
  compaction_strategy_class='SizeTieredCompactionStrategy' AND
  compression_parameters:sstable_compression='SnappyCompressor';


CREATE TABLE logdata (
  timestamp text,
  lineid text,
  value text,
  PRIMARY KEY (time, lineid)
) WITH
  comment='' AND
  caching='KEYS_ONLY' AND
  read_repair_chance=0.100000 AND
  gc_grace_seconds=864000 AND
  min_compaction_threshold=4 AND
  max_compaction_threshold=32 AND
  replicate_on_write='true' AND
  compaction_strategy_class='SizeTieredCompactionStrategy' AND
  compression_parameters:sstable_compression='SnappyCompressor';

i still get that error when insert

Can we use a Column family which have two columns as primary key like as RDBMS , and other columns is non composite type ???  ( my data is the weblog , we want to use timestamp ,and a autoincrement integer as a primary key) to partition data in such query (in CQL)

select * From logdata where timestamp=?? ==> do any thing analytic with this data

my data example :
timestamp               |  data
2012-05-24 10:44:12 | 2  Firefox...
2012-05-24 10:44:12  | 2  MSIE...





2012/6/25 Nate McCall <zznate.m-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
You have declared the column name to have the same type of comparator
as the key validation class.

The composite key is constructed correctly the column is not. The name
is a single string were it should be a composite constructed similarly
to the key (or change the default_comparator to a non-composite UTF8).

On Mon, Jun 25, 2012 at 2:17 AM, nguyen khac tu <tubcvt-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> hi all
> i have a column family AllLog create that
>
> create column family LogData
>   with column_type = 'Standard'
>   and comparator =
> 'CompositeType(org.apache.cassandra.db.marshal.UTF8Type,org.apache.cassandra.db.marshal.UTF8Type)'
>   and default_validation_class = 'UTF8Type'
>   and key_validation_class = 'CompositeType(UTF8Type,UTF8Type)';
>
> but when i use mutator to insert :
>
>         String key0 = "key0";
>         String key1 = "key1";
>
>         Composite compositeKey = new Composite();
>         compositeKey.addComponent(key0, StringSerializer.get());
>         compositeKey.addComponent(key1, StringSerializer.get());
>
>         // add
>         mutator.addInsertion(compositeKey, columnFamilyName,
> HFactory.createColumn("name", "value"));
>         mutator.execute();
>
> always through exception:
>
> me.prettyprint.hector.api.exceptions.HInvalidRequestException:
> InvalidRequestException(why:Not enough bytes to read value of component 0)
>
> please some one help me, where is my mistake in this code :( ??????????
>
> thanks all
>
>
>
>
>
>



--
Nguyen Khac Tu
Nate McCall | 25 Jun 2012 18:23
Picon
Gravatar

Re: cannot insert composite key

Can you show the table creation script from the "cassandra-cli" via
"show create schema"?

I don't yet have my head around the magic produced by the cql-3 table
creation scripts and their underlying composite stuff.

On Mon, Jun 25, 2012 at 11:03 AM, nguyen khac tu <tubcvt@...> wrote:
> thanks for helping me ,, I think  i 'm wrong when set
> comparator  ="composite"
>
> but when i changed columnfamily logdata to :
>
>
> CREATE TABLE logdata (
>   time text,
>   lineid text,
>   value text,
>   PRIMARY KEY (time, lineid)
> ) WITH
>   comment='' AND
>   caching='KEYS_ONLY' AND
>   read_repair_chance=0.100000 AND
>   gc_grace_seconds=864000 AND
>   min_compaction_threshold=4 AND
>   max_compaction_threshold=32 AND
>   replicate_on_write='true' AND
>   compaction_strategy_class='SizeTieredCompactionStrategy' AND
>   compression_parameters:sstable_compression='SnappyCompressor';
>
>
> CREATE TABLE logdata (
>   timestamp text,
>   lineid text,
>   value text,
>   PRIMARY KEY (time, lineid)
> ) WITH
>   comment='' AND
>   caching='KEYS_ONLY' AND
>   read_repair_chance=0.100000 AND
>   gc_grace_seconds=864000 AND
>   min_compaction_threshold=4 AND
>   max_compaction_threshold=32 AND
>   replicate_on_write='true' AND
>   compaction_strategy_class='SizeTieredCompactionStrategy' AND
>   compression_parameters:sstable_compression='SnappyCompressor';
>
> i still get that error when insert
>
> Can we use a Column family which have two columns as primary key like as
> RDBMS , and other columns is non composite type ???  ( my data is the weblog
> , we want to use timestamp ,and a autoincrement integer as a primary key) to
> partition data in such query (in CQL)
>
> select * From logdata where timestamp=?? ==> do any thing analytic with this
> data
>
> my data example :
> timestamp               |  data
> 2012-05-24 10:44:12 | 2  Firefox...
> 2012-05-24 10:44:12  | 2  MSIE...
>
>
>
>
>
> 2012/6/25 Nate McCall <zznate.m@...>
>>
>> You have declared the column name to have the same type of comparator
>> as the key validation class.
>>
>> The composite key is constructed correctly the column is not. The name
>> is a single string were it should be a composite constructed similarly
>> to the key (or change the default_comparator to a non-composite UTF8).
>>
>> On Mon, Jun 25, 2012 at 2:17 AM, nguyen khac tu <tubcvt@...> wrote:
>> > hi all
>> > i have a column family AllLog create that
>> >
>> > create column family LogData
>> >   with column_type = 'Standard'
>> >   and comparator =
>> >
>> > 'CompositeType(org.apache.cassandra.db.marshal.UTF8Type,org.apache.cassandra.db.marshal.UTF8Type)'
>> >   and default_validation_class = 'UTF8Type'
>> >   and key_validation_class = 'CompositeType(UTF8Type,UTF8Type)';
>> >
>> > but when i use mutator to insert :
>> >
>> >         String key0 = "key0";
>> >         String key1 = "key1";
>> >
>> >         Composite compositeKey = new Composite();
>> >         compositeKey.addComponent(key0, StringSerializer.get());
>> >         compositeKey.addComponent(key1, StringSerializer.get());
>> >
>> >         // add
>> >         mutator.addInsertion(compositeKey, columnFamilyName,
>> > HFactory.createColumn("name", "value"));
>> >         mutator.execute();
>> >
>> > always through exception:
>> >
>> > me.prettyprint.hector.api.exceptions.HInvalidRequestException:
>> > InvalidRequestException(why:Not enough bytes to read value of component
>> > 0)
>> >
>> > please some one help me, where is my mistake in this code :( ??????????
>> >
>> > thanks all
>> >
>> >
>> >
>> >
>> >
>> >
>
>
>
>
> --
> Nguyen Khac Tu

nguyen khac tu | 25 Jun 2012 18:28
Picon

Re: cannot insert composite key

here my CF create scrip in cassandra-cli :


create column family logdata
  with column_type = 'Standard'
  and comparator = 'CompositeType(org.apache.cassandra.db.marshal.UTF8Type,org.apache.cassandra.db.marshal.UTF8Type)'
  and default_validation_class = 'UTF8Type'
  and key_validation_class = 'UTF8Type'
  and read_repair_chance = 0.1
  and dclocal_read_repair_chance = 0.0
  and gc_grace = 864000
  and min_compaction_threshold = 4
  and max_compaction_threshold = 32
  and replicate_on_write = true
  and compaction_strategy = 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy'
  and caching = 'KEYS_ONLY'
  and compression_options = {'sstable_compression' : 'org.apache.cassandra.io.compress.SnappyCompressor'};

use this table in cql3 i can do such i write in previous email :
i can use this query similar: 

select * FROM logdata where time='22-01-2012';

or 

select * FROM logdata where time='22-01-2012' and lineId=3

but i can't do this in Hector , can you give an example for me ?? :(


2012/6/25 Nate McCall <zznate.m-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Can you show the table creation script from the "cassandra-cli" via
"show create schema"?

I don't yet have my head around the magic produced by the cql-3 table
creation scripts and their underlying composite stuff.

On Mon, Jun 25, 2012 at 11:03 AM, nguyen khac tu <tubcvt-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> thanks for helping me ,, I think  i 'm wrong when set
> comparator  ="composite"
>
> but when i changed columnfamily logdata to :
>
>
> CREATE TABLE logdata (
>   time text,
>   lineid text,
>   value text,
>   PRIMARY KEY (time, lineid)
> ) WITH
>   comment='' AND
>   caching='KEYS_ONLY' AND
>   read_repair_chance=0.100000 AND
>   gc_grace_seconds=864000 AND
>   min_compaction_threshold=4 AND
>   max_compaction_threshold=32 AND
>   replicate_on_write='true' AND
>   compaction_strategy_class='SizeTieredCompactionStrategy' AND
>   compression_parameters:sstable_compression='SnappyCompressor';
>
>
> CREATE TABLE logdata (
>   timestamp text,
>   lineid text,
>   value text,
>   PRIMARY KEY (time, lineid)
> ) WITH
>   comment='' AND
>   caching='KEYS_ONLY' AND
>   read_repair_chance=0.100000 AND
>   gc_grace_seconds=864000 AND
>   min_compaction_threshold=4 AND
>   max_compaction_threshold=32 AND
>   replicate_on_write='true' AND
>   compaction_strategy_class='SizeTieredCompactionStrategy' AND
>   compression_parameters:sstable_compression='SnappyCompressor';
>
> i still get that error when insert
>
> Can we use a Column family which have two columns as primary key like as
> RDBMS , and other columns is non composite type ???  ( my data is the weblog
> , we want to use timestamp ,and a autoincrement integer as a primary key) to
> partition data in such query (in CQL)
>
> select * From logdata where timestamp=?? ==> do any thing analytic with this
> data
>
> my data example :
> timestamp               |  data
> 2012-05-24 10:44:12 | 2  Firefox...
> 2012-05-24 10:44:12  | 2  MSIE...
>
>
>
>
>
> 2012/6/25 Nate McCall <zznate.m <at> gmail.com>
>>
>> You have declared the column name to have the same type of comparator
>> as the key validation class.
>>
>> The composite key is constructed correctly the column is not. The name
>> is a single string were it should be a composite constructed similarly
>> to the key (or change the default_comparator to a non-composite UTF8).
>>
>> On Mon, Jun 25, 2012 at 2:17 AM, nguyen khac tu <tubcvt-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>> > hi all
>> > i have a column family AllLog create that
>> >
>> > create column family LogData
>> >   with column_type = 'Standard'
>> >   and comparator =
>> >
>> > 'CompositeType(org.apache.cassandra.db.marshal.UTF8Type,org.apache.cassandra.db.marshal.UTF8Type)'
>> >   and default_validation_class = 'UTF8Type'
>> >   and key_validation_class = 'CompositeType(UTF8Type,UTF8Type)';
>> >
>> > but when i use mutator to insert :
>> >
>> >         String key0 = "key0";
>> >         String key1 = "key1";
>> >
>> >         Composite compositeKey = new Composite();
>> >         compositeKey.addComponent(key0, StringSerializer.get());
>> >         compositeKey.addComponent(key1, StringSerializer.get());
>> >
>> >         // add
>> >         mutator.addInsertion(compositeKey, columnFamilyName,
>> > HFactory.createColumn("name", "value"));
>> >         mutator.execute();
>> >
>> > always through exception:
>> >
>> > me.prettyprint.hector.api.exceptions.HInvalidRequestException:
>> > InvalidRequestException(why:Not enough bytes to read value of component
>> > 0)
>> >
>> > please some one help me, where is my mistake in this code :( ??????????
>> >
>> > thanks all
>> >
>> >
>> >
>> >
>> >
>> >
>
>
>
>
> --
> Nguyen Khac Tu



--
Nguyen Khac Tu
Nate McCall | 25 Jun 2012 18:43
Picon
Gravatar

Re: cannot insert composite key

Are you getting an exception back from hector with this new column
family? Or is it just not returning anything?

On Mon, Jun 25, 2012 at 11:28 AM, nguyen khac tu <tubcvt@...> wrote:
> here my CF create scrip in cassandra-cli :
>
> create column family logdata
>   with column_type = 'Standard'
>   and comparator =
> 'CompositeType(org.apache.cassandra.db.marshal.UTF8Type,org.apache.cassandra.db.marshal.UTF8Type)'
>   and default_validation_class = 'UTF8Type'
>   and key_validation_class = 'UTF8Type'
>   and read_repair_chance = 0.1
>   and dclocal_read_repair_chance = 0.0
>   and gc_grace = 864000
>   and min_compaction_threshold = 4
>   and max_compaction_threshold = 32
>   and replicate_on_write = true
>   and compaction_strategy =
> 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy'
>   and caching = 'KEYS_ONLY'
>   and compression_options = {'sstable_compression' :
> 'org.apache.cassandra.io.compress.SnappyCompressor'};
>
> use this table in cql3 i can do such i write in previous email :
> i can use this query similar:
>
> select * FROM logdata where time='22-01-2012';
>
> or
>
> select * FROM logdata where time='22-01-2012' and lineId=3
>
> but i can't do this in Hector , can you give an example for me ?? :(
>
>
> 2012/6/25 Nate McCall <zznate.m@...>
>>
>> Can you show the table creation script from the "cassandra-cli" via
>> "show create schema"?
>>
>> I don't yet have my head around the magic produced by the cql-3 table
>> creation scripts and their underlying composite stuff.
>>
>> On Mon, Jun 25, 2012 at 11:03 AM, nguyen khac tu <tubcvt@...> wrote:
>> > thanks for helping me ,, I think  i 'm wrong when set
>> > comparator  ="composite"
>> >
>> > but when i changed columnfamily logdata to :
>> >
>> >
>> > CREATE TABLE logdata (
>> >   time text,
>> >   lineid text,
>> >   value text,
>> >   PRIMARY KEY (time, lineid)
>> > ) WITH
>> >   comment='' AND
>> >   caching='KEYS_ONLY' AND
>> >   read_repair_chance=0.100000 AND
>> >   gc_grace_seconds=864000 AND
>> >   min_compaction_threshold=4 AND
>> >   max_compaction_threshold=32 AND
>> >   replicate_on_write='true' AND
>> >   compaction_strategy_class='SizeTieredCompactionStrategy' AND
>> >   compression_parameters:sstable_compression='SnappyCompressor';
>> >
>> >
>> > CREATE TABLE logdata (
>> >   timestamp text,
>> >   lineid text,
>> >   value text,
>> >   PRIMARY KEY (time, lineid)
>> > ) WITH
>> >   comment='' AND
>> >   caching='KEYS_ONLY' AND
>> >   read_repair_chance=0.100000 AND
>> >   gc_grace_seconds=864000 AND
>> >   min_compaction_threshold=4 AND
>> >   max_compaction_threshold=32 AND
>> >   replicate_on_write='true' AND
>> >   compaction_strategy_class='SizeTieredCompactionStrategy' AND
>> >   compression_parameters:sstable_compression='SnappyCompressor';
>> >
>> > i still get that error when insert
>> >
>> > Can we use a Column family which have two columns as primary key like as
>> > RDBMS , and other columns is non composite type ???  ( my data is the
>> > weblog
>> > , we want to use timestamp ,and a autoincrement integer as a primary
>> > key) to
>> > partition data in such query (in CQL)
>> >
>> > select * From logdata where timestamp=?? ==> do any thing analytic with
>> > this
>> > data
>> >
>> > my data example :
>> > timestamp               |  data
>> > 2012-05-24 10:44:12 | 2  Firefox...
>> > 2012-05-24 10:44:12  | 2  MSIE...
>> >
>> >
>> >
>> >
>> >
>> > 2012/6/25 Nate McCall <zznate.m@...>
>> >>
>> >> You have declared the column name to have the same type of comparator
>> >> as the key validation class.
>> >>
>> >> The composite key is constructed correctly the column is not. The name
>> >> is a single string were it should be a composite constructed similarly
>> >> to the key (or change the default_comparator to a non-composite UTF8).
>> >>
>> >> On Mon, Jun 25, 2012 at 2:17 AM, nguyen khac tu <tubcvt@...>
>> >> wrote:
>> >> > hi all
>> >> > i have a column family AllLog create that
>> >> >
>> >> > create column family LogData
>> >> >   with column_type = 'Standard'
>> >> >   and comparator =
>> >> >
>> >> >
>> >> > 'CompositeType(org.apache.cassandra.db.marshal.UTF8Type,org.apache.cassandra.db.marshal.UTF8Type)'
>> >> >   and default_validation_class = 'UTF8Type'
>> >> >   and key_validation_class = 'CompositeType(UTF8Type,UTF8Type)';
>> >> >
>> >> > but when i use mutator to insert :
>> >> >
>> >> >         String key0 = "key0";
>> >> >         String key1 = "key1";
>> >> >
>> >> >         Composite compositeKey = new Composite();
>> >> >         compositeKey.addComponent(key0, StringSerializer.get());
>> >> >         compositeKey.addComponent(key1, StringSerializer.get());
>> >> >
>> >> >         // add
>> >> >         mutator.addInsertion(compositeKey, columnFamilyName,
>> >> > HFactory.createColumn("name", "value"));
>> >> >         mutator.execute();
>> >> >
>> >> > always through exception:
>> >> >
>> >> > me.prettyprint.hector.api.exceptions.HInvalidRequestException:
>> >> > InvalidRequestException(why:Not enough bytes to read value of
>> >> > component
>> >> > 0)
>> >> >
>> >> > please some one help me, where is my mistake in this code :(
>> >> > ??????????
>> >> >
>> >> > thanks all
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >
>> >
>> >
>> >
>> > --
>> > Nguyen Khac Tu
>
>
>
>
> --
> Nguyen Khac Tu

nguyen khac tu | 25 Jun 2012 18:48
Picon

Re: cannot insert composite key

thanks for helping me


I use Hector to insert value (with code i post in first email in this thread) , but i can't , i get this exception:

me.prettyprint.hector.api.exceptions.HInvalidRequestException: InvalidRequestException(why:Not enough bytes to read value of component 0)
at me.prettyprint.cassandra.service.ExceptionsTranslatorImpl.translate(ExceptionsTranslatorImpl.java:45)
at me.prettyprint.cassandra.connection.HConnectionManager.operateWithFailover(HConnectionManager.java:264)
at me.prettyprint.cassandra.model.ExecutingKeyspace.doExecuteOperation(ExecutingKeyspace.java:97)
at me.prettyprint.cassandra.model.MutatorImpl.execute(MutatorImpl.java:243)
        ... ..

:( :( 


2012/6/25 Nate McCall <zznate.m-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Are you getting an exception back from hector with this new column
family? Or is it just not returning anything?

On Mon, Jun 25, 2012 at 11:28 AM, nguyen khac tu <tubcvt-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> here my CF create scrip in cassandra-cli :
>
> create column family logdata
>   with column_type = 'Standard'
>   and comparator =
> 'CompositeType(org.apache.cassandra.db.marshal.UTF8Type,org.apache.cassandra.db.marshal.UTF8Type)'
>   and default_validation_class = 'UTF8Type'
>   and key_validation_class = 'UTF8Type'
>   and read_repair_chance = 0.1
>   and dclocal_read_repair_chance = 0.0
>   and gc_grace = 864000
>   and min_compaction_threshold = 4
>   and max_compaction_threshold = 32
>   and replicate_on_write = true
>   and compaction_strategy =
> 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy'
>   and caching = 'KEYS_ONLY'
>   and compression_options = {'sstable_compression' :
> 'org.apache.cassandra.io.compress.SnappyCompressor'};
>
> use this table in cql3 i can do such i write in previous email :
> i can use this query similar:
>
> select * FROM logdata where time='22-01-2012';
>
> or
>
> select * FROM logdata where time='22-01-2012' and lineId=3
>
> but i can't do this in Hector , can you give an example for me ?? :(
>
>
> 2012/6/25 Nate McCall <zznate.m <at> gmail.com>
>>
>> Can you show the table creation script from the "cassandra-cli" via
>> "show create schema"?
>>
>> I don't yet have my head around the magic produced by the cql-3 table
>> creation scripts and their underlying composite stuff.
>>
>> On Mon, Jun 25, 2012 at 11:03 AM, nguyen khac tu <tubcvt-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>> > thanks for helping me ,, I think  i 'm wrong when set
>> > comparator  ="composite"
>> >
>> > but when i changed columnfamily logdata to :
>> >
>> >
>> > CREATE TABLE logdata (
>> >   time text,
>> >   lineid text,
>> >   value text,
>> >   PRIMARY KEY (time, lineid)
>> > ) WITH
>> >   comment='' AND
>> >   caching='KEYS_ONLY' AND
>> >   read_repair_chance=0.100000 AND
>> >   gc_grace_seconds=864000 AND
>> >   min_compaction_threshold=4 AND
>> >   max_compaction_threshold=32 AND
>> >   replicate_on_write='true' AND
>> >   compaction_strategy_class='SizeTieredCompactionStrategy' AND
>> >   compression_parameters:sstable_compression='SnappyCompressor';
>> >
>> >
>> > CREATE TABLE logdata (
>> >   timestamp text,
>> >   lineid text,
>> >   value text,
>> >   PRIMARY KEY (time, lineid)
>> > ) WITH
>> >   comment='' AND
>> >   caching='KEYS_ONLY' AND
>> >   read_repair_chance=0.100000 AND
>> >   gc_grace_seconds=864000 AND
>> >   min_compaction_threshold=4 AND
>> >   max_compaction_threshold=32 AND
>> >   replicate_on_write='true' AND
>> >   compaction_strategy_class='SizeTieredCompactionStrategy' AND
>> >   compression_parameters:sstable_compression='SnappyCompressor';
>> >
>> > i still get that error when insert
>> >
>> > Can we use a Column family which have two columns as primary key like as
>> > RDBMS , and other columns is non composite type ???  ( my data is the
>> > weblog
>> > , we want to use timestamp ,and a autoincrement integer as a primary
>> > key) to
>> > partition data in such query (in CQL)
>> >
>> > select * From logdata where timestamp=?? ==> do any thing analytic with
>> > this
>> > data
>> >
>> > my data example :
>> > timestamp               |  data
>> > 2012-05-24 10:44:12 | 2  Firefox...
>> > 2012-05-24 10:44:12  | 2  MSIE...
>> >
>> >
>> >
>> >
>> >
>> > 2012/6/25 Nate McCall <zznate.m-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>> >>
>> >> You have declared the column name to have the same type of comparator
>> >> as the key validation class.
>> >>
>> >> The composite key is constructed correctly the column is not. The name
>> >> is a single string were it should be a composite constructed similarly
>> >> to the key (or change the default_comparator to a non-composite UTF8).
>> >>
>> >> On Mon, Jun 25, 2012 at 2:17 AM, nguyen khac tu <tubcvt-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>> >> wrote:
>> >> > hi all
>> >> > i have a column family AllLog create that
>> >> >
>> >> > create column family LogData
>> >> >   with column_type = 'Standard'
>> >> >   and comparator =
>> >> >
>> >> >
>> >> > 'CompositeType(org.apache.cassandra.db.marshal.UTF8Type,org.apache.cassandra.db.marshal.UTF8Type)'
>> >> >   and default_validation_class = 'UTF8Type'
>> >> >   and key_validation_class = 'CompositeType(UTF8Type,UTF8Type)';
>> >> >
>> >> > but when i use mutator to insert :
>> >> >
>> >> >         String key0 = "key0";
>> >> >         String key1 = "key1";
>> >> >
>> >> >         Composite compositeKey = new Composite();
>> >> >         compositeKey.addComponent(key0, StringSerializer.get());
>> >> >         compositeKey.addComponent(key1, StringSerializer.get());
>> >> >
>> >> >         // add
>> >> >         mutator.addInsertion(compositeKey, columnFamilyName,
>> >> > HFactory.createColumn("name", "value"));
>> >> >         mutator.execute();
>> >> >
>> >> > always through exception:
>> >> >
>> >> > me.prettyprint.hector.api.exceptions.HInvalidRequestException:
>> >> > InvalidRequestException(why:Not enough bytes to read value of
>> >> > component
>> >> > 0)
>> >> >
>> >> > please some one help me, where is my mistake in this code :(
>> >> > ??????????
>> >> >
>> >> > thanks all
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >
>> >
>> >
>> >
>> > --
>> > Nguyen Khac Tu
>
>
>
>
> --
> Nguyen Khac Tu



--
Nguyen Khac Tu

Gmane