Custom Search

Wednesday, March 18, 2015

how to cassandra Convert hex byte values into a human readable format

1)
Open cassandra cli

#cassandra-cli

[..] help;
[..] show keyspaces;
[..] use config_db_uuid; <== select a keyspace/database
[..] List obj_uuid_table; <== Reading Rows and Columns of a table



* Cassandra stores all data internally as hex byte arrays by default. If you do not specify a default row key validation class, column comparator and column validation class when you define the column family, Cassandra CLI will expect input data for row keys, column names, and column values to be in hex format (and data will be returned in hex format).
http://www.datastax.com/docs/1.1/dml/using_cli


ASSUME obj_uuid_table KEYS AS utf8;
ASSUME obj_uuid_table COMPARATOR AS utf8;
ASSUME obj_uuid_table VALIDATOR AS utf8;


OR

ASSUME obj_uuid_table KEYS AS ascii;
ASSUME obj_uuid_table COMPARATOR AS ascii;
ASSUME obj_uuid_table VALIDATOR AS ascii;


[..]List obj_uuid_table <== Reading Rows and Columns of a table

2)
Reset

ASSUME obj_uuid_table KEYS AS bytes;
ASSUME obj_uuid_table COMPARATOR AS bytes;
ASSUME obj_uuid_table VALIDATOR AS bytes;



No comments:

Post a Comment