Cassandra cannot parse ‘my_key’ as hex bytes

If you have “cannot parse ‘whatever_my_key’ as hex bytes” when you try to query Cassandra for some data, as in example below:

get ServerLog['my_key'] limit 10;
 
org.apache.cassandra.db.marshal.MarshalException: cannot parse 'my_key' as hex bytes

then you must set the client-side encoding with assume command:

assume ServerLog keys as utf8;

 

 

2 thoughts on “Cassandra cannot parse ‘my_key’ as hex bytes”

  1. What about actually teaching Cassandra what’s the type of the key for that column?

    update column family ServerLog with key_validation_class=UTF8Type;

    I think this will clear up all doubts for Cassandra

Leave a Reply to paolo Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.