Looks like validation class for composite column value is different than
UTF8Type? Though code suggests it is:
       composite.addComponent("TEXT1", StringSerializer.get());

Please validate.

-Vivek


On Thu, Jul 18, 2013 at 7:41 PM, <anand_balara...@homedepot.com> wrote:

>  Hi
>
>
>
> I have an issue while inserting a composite column name to one of the
> Cassandra column families. Below is a detailed description of what I had
> done and stuck up at.
>
> Please let me know where I had went wrong.
>
>
>
> Requirement:
>
> ------------------
>
>        Rowkey        ->     RowIdString
>
>        Column name   ->     TEXT1 : value1 : TEXT2 : value2 : TEXT3
>
>        Column value ->     value3
>
>
>
> Column family definition:
>
> -------------------------------
>
>                 create column family CompositeColumnNameTest
>
>        WITH
> comparator='CompositeType(UTF8Type,UTF8Type,UTF8Type,UTF8Type,UTF8Type)'
>
>        AND key_validation_class=UTF8Type
>
>        WITH compression_options={sstable_compression:SnappyCompressor,
> chunk_length_kb:64};
>
>
>
> Code:
>
> --------
>
>                 String RowIdString = "1234";
>
>
>
>        Composite composite = new Composite();
>
>        composite.addComponent("TEXT1", StringSerializer.get());
>
>        composite.addComponent("value1", StringSerializer.get());
>
>        composite.addComponent("TEXT2", StringSerializer.get());
>
>        composite.addComponent("value3", StringSerializer.get());
>
>        composite.addComponent("TEXT3", StringSerializer.get());
>
>
>
>        Column column = new Column(composite.serialize());
>
>        column.setValue("value3".getBytes());
>
>        column.setTimestamp(System.currentTimeMillis());
>
>
>
>        // push data to cassandra
>
>        batchMutate.addInsertion(RowIdString, "CompositeColumnNameTest",
> column);
>
>        keyspaceServiceImpl.batchMutate(batchMutate);
>
>
>
> 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.service.KeyspaceServiceImpl$1.execute(KeyspaceServiceImpl.java:97)
>
>        at
> me.prettyprint.cassandra.service.KeyspaceServiceImpl$1.execute(KeyspaceServiceImpl.java:90)
>
>        at
> me.prettyprint.cassandra.service.Operation.executeAndSetResult(Operation.java:103)
>
>        at
> me.prettyprint.cassandra.connection.HConnectionManager.operateWithFailover(HConnectionManager.java:258)
>
>        at
> me.prettyprint.cassandra.service.KeyspaceServiceImpl.operateWithFailover(KeyspaceServiceImpl.java:131)
>
>
>
>
>
> Thanks in advance
>
> -Anand
>
> ------------------------------
>
> The information in this Internet Email is confidential and may be legally
> privileged. It is intended solely for the addressee. Access to this Email
> by anyone else is unauthorized. If you are not the intended recipient, any
> disclosure, copying, distribution or any action taken or omitted to be
> taken in reliance on it, is prohibited and may be unlawful. When addressed
> to our clients any opinions or advice contained in this Email are subject
> to the terms and conditions expressed in any applicable governing The Home
> Depot terms of business or client engagement letter. The Home Depot
> disclaims all responsibility and liability for the accuracy and content of
> this attachment and for any damages or losses arising from any
> inaccuracies, errors, viruses, e.g., worms, trojan horses, etc., or other
> items of a destructive nature, which may be contained in this attachment
> and shall not be liable for direct, indirect, consequential or special
> damages in connection with this e-mail message or its attachment.
>

Reply via email to