incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <ANAND_BALARA...@homedepot.com>
Subject RE: Exception while writing compsite column names
Date Thu, 18 Jul 2013 18:18:15 GMT
Output of describe command is:

[default@Test] describe CompositeColumnNameTest;
    ColumnFamily: CompositeColumnNameTest
      Key Validation Class: org.apache.cassandra.db.marshal.UTF8Type
      Default column value validator: org.apache.cassandra.db.marshal.UTF8Type
      Columns sorted by: org.apache.cassandra.db.marshal.CompositeType(org.apache.cassandra.db.marshal.UTF8Type,org.apache.cassandra.db.marshal.UTF8Ty
pe,org.apache.cassandra.db.marshal.UTF8Type,org.apache.cassandra.db.marshal.UTF8Type,org.apache.cassandra.db.marshal.UTF8Type)
      GC grace seconds: 864000
      Compaction min/max thresholds: 4/32
      Read repair chance: 0.1
      DC Local Read repair chance: 0.0
      Replicate on write: true
      Caching: KEYS_ONLY
      Bloom Filter FP chance: default
      Built indexes: []
      Compaction Strategy: org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy
      Compression Options:
        chunk_length_kb: 64
        sstable_compression: org.apache.cassandra.io.compress.SnappyCompressor

Vivek. The problem was not with this composite column.
I was loading yet another column (not composite) which was getting data in the below format:
a40be0d3-5c49-446d-a835-ef6af29c016e
bc79d3ef-18fd-4891-8b2c-1fdae404318c
bf15fa45-176c-4749-8481-2c8a2f9dd70f

It is a key (String) which I need to store along with the other data. If I leave out this
column alone, my loader program works well.
Till it comes to my program, it is displayed as String. But, during insert, I get the exception.
Could you please suggest what data type am I supposed to use for such data?

Thanks and Regards
Anand

From: Vivek Mishra [mailto:mishra.vivs@gmail.com]
Sent: Thursday, July 18, 2013 1:24 PM
To: user@cassandra.apache.org
Subject: Re: Exception while writing compsite column names

Yes. can you please share output of describe keyspace which contains "CompositeColumnNameTest"
What is the datatype for column values?

-Vive

On Thu, Jul 18, 2013 at 9:17 PM, <ANAND_BALARAMAN@homedepot.com<mailto:ANAND_BALARAMAN@homedepot.com>>
wrote:
I had been using the StringSerilaizer.get() for all UTF8Type fields so far. Do not think I
need to check the code.
Do you suspect the column family definition?

-Anand

From: Vivek Mishra [mailto:mishra.vivs@gmail.com<mailto:mishra.vivs@gmail.com>]
Sent: Thursday, July 18, 2013 11:29 AM
To: user@cassandra.apache.org<mailto:user@cassandra.apache.org>
Subject: Re: Exception while writing compsite column names

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_BALARAMAN@homedepot.com<mailto:ANAND_BALARAMAN@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.


________________________________

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.


________________________________

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.

Mime
View raw message