Wednesday, January 8, 2014

Cassandra Database cannot parse as hex bytes


##########################
## Error
##########################

cannot parse 'fname' as hex bytes



### Full Error

[default@MyKeyspace] Set user['sri']['fname']='Sri';
org.apache.cassandra.serializers.MarshalException: cannot parse 'fname' as hex bytes
[default@MyKeyspace]

##########################
#  Error Occurred
##########################

Error occured while trying to insert a new column in a row key value in Cassandra 2.0.4 version

##########################
## Command Executed
##########################

Set user['sri']['fname']='Sri';

**************************************** Step By Step Analysis ******************************************************

#########################################
# Reason for Failure
#########################################

When we tried to add a new column to a Row key called "sri" in a column family called "user", cassandra cant create as it cant validate the values provided as hex bytes.

So we need to let cassandra assume what type of values will be stored in the Column Family (user)

=====================================================================================================================

#########################################
# Solution
#########################################

assume user keys as utf8;
assume user comparator as utf8;
assume user validator as utf8;

Where,

user - Column Family



Once We modified the Column Family(user) we can insert a column and assign a value to it as below,





=====================================================================================================================

No comments:

Post a Comment