Cassandra Query Language not read the data inserted by Astyanax

1

I have insert the data in Cassandra using Astyanax but when I execute the following query using CQL3 then result is in Hex

select * from employees1;

Result:

 key        | column1                | value
------------+------------------------+------------------
0x000000de |         0x646570746964 |       0x0000014d

Then I come to know that Astyanax also support CQL, then I use this and insert the record in Cassandra, then I run the above query and It successfully shows the record as follow.

 empid | deptid | first_name | last_name
 -------+--------+------------+-----------
 222 |    333 |       Eric |   Cartman  

Why CQL3 not read the data inserted by Astyanax? is apache cassandra not provide standard implementation way ? what is the game behind?

I am new to Cassandra.

java
cassandra
cql
cql3
astyanax
asked on Stack Overflow Nov 25, 2013 by Shahid Ghafoor • edited Jul 19, 2019 by Vadim Kotov

1 Answer

2

I had/have this exact problem. For me, the problem was that the my tables were created as column families via the cassandra-cli, and with the bytesType comparator.

From within cqlsh, try this:

describe table employees1;

If you see something like this:

CREATE TABLE "employees1" (
  key blob,
  column1 blob,
  value blob,
  PRIMARY KEY (key, column1)
) WITH COMPACT STORAGE AND
  bloom_filter_fp_chance=0.010000 AND
  caching='KEYS_ONLY' AND
  comment='' AND
  dclocal_read_repair_chance=0.000000 AND
  gc_grace_seconds=864000 AND
  read_repair_chance=0.100000 AND
  replicate_on_write='true' AND
  compaction={'class': 'SizeTieredCompactionStrategy'} AND
  compression={'sstable_compression': 'SnappyCompressor'};

That means your table is a legacy column family. In order to query the data (cqlsh) in a readable format, the fields need to be something other than blob, like varchar or int. Unfortunately, I think that blob and varchar are incompatible types, so you might have to re-create the table and reload.

answered on Stack Overflow Nov 25, 2013 by Aaron • edited Nov 25, 2013 by Aaron

User contributions licensed under CC BY-SA 3.0