You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by William Oberman <ob...@civicscience.com> on 2013/07/03 20:15:29 UTC

cqlsh + existing cf's + query

I've been running cassandra a while, and have used the PHP api and
cassandra-cli, but never gave cqlsh a shot.

I'm not quite getting it.  My most simple CF is a dumping ground for
testing things created as:
create column family stats;
I was putting random stats I was computing in it.  All keys, column names &
column values are really ascii.

Using cqlsh (1.1.12, default shell so CQL 2.0 I believe), I did:
USE my_keyspace_name;
ASSUME stats(KEY) VALUES are text, NAMES are text, VALUES are text;
SELECT * from stats LIMIT 10;

Looks great.  But, then I try to do:
SELECT * from stats WHERE KEY='KNOWN_KEY_NAME';

I get:
Bad Request: cannot parse 'KNOWN_KEY_NAME' as hex bytes

If I do the hex value for KNOWN_KEY_NAME, it works.  E.g.
SELECT * from stats WHERE KEY='various_0-9a-f_chars';

I can't find a "TO_HEX(string)" built in function for SQL.  Am I doing
something wrong?

DESCRIBE TABLE stats;

CREATE TABLE stats (
  KEY blob PRIMARY KEY
) WITH
  comment='' AND
  comparator=blob AND
  read_repair_chance=1.000000 AND
  gc_grace_seconds=864000 AND
  default_validation=blob AND
  min_compaction_threshold=4 AND
  max_compaction_threshold=32 AND
  replicate_on_write='false' AND
  compaction_strategy_class='SizeTieredCompactionStrategy';