2

I have an operational cassandra cluster with the tarball installation of apache Cassandra 3.7 in a single data center mode.

CQLSH Issue: When I describe the column family I see the column names are correctly shown but when I do a select on the table I see that all the column names are prefixed with 'u':

cassandra@cqlsh> describe cassandra_test.employee; 
CREATE TABLE cassandra_test.employee (
    employee_id text PRIMARY KEY,         
    employee_grp_cd text, 
    employee mbrp_id text ) 
WITH bloom filter_fp_chance = 0.01         
    AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'} 
    AND comment = " 
    AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max threshold': '32', emin_threshold': '4'} 
    AND compression = fichunk_length_in_kb1: '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'l 
    AND crc_check_chance = 1.0 
    AND dclocal_read_repair_chance = 0.1 
    AND default_time_to_live = 0 
    AND gc_grace_seconds = 864000 
    AND max_index_interval = 2048 
    AND memtable_flush_period_in ms = 0 
    AND min_indexinterval = 128 
    AND read_repair_chance = 0.0 
    AND speculative_retry = '99PERCENTILE'; 
cassandra@cqlsh> select * from cassandra_test.employee; 

u'employee_id' | u'employee_grp_cd' | u'employee_mbrp_id' 
---------------+--------------------+----------------------

(0 rows) 
Failed to format value u'employee_id' : 'unicode' object has no attribute 'formatter' 
Failed to format value u'employee_grp_cd' : 'unicode' object has no attribute 'formatter' 1 more decoding errors suppressed. cassandra@cqlsh> 0 
1 more decoding errors suppressed.

When I insert records and do a select the inserted values are also prefixed with 'u'. I made several attempts and every related link seems to point out to python problem.

My current python version: Python 2.7.11 :: Anaconda 4.0.0 (64-bit) and I did a pip install cassandra-driver to install any missing dependencies for Cassandra driver. This has not fixed the issue.

Any help is highly appreciated. I have spent a quality time to figure out the fix and hoping I could get some answer here :)

Nate Anderson
  • 18,334
  • 18
  • 100
  • 135
shravan
  • 21
  • 2
  • Welcome to StackOverflow! Please don't post links to images/screenshots that just contain text. Copy/paste the terminal activity directly into your question. http://stackoverflow.com/help/how-to-ask – Aaron Mar 06 '17 at 18:54
  • This does not happen for me running `cqlsh` with that Python runtime. It's a little confusing because one would typically see that error with Python < 2.6, but `cqlsh` won't start in that case. Can you try `cqlsh --debug -e "select * from cassandra_test.employee;"`? – Adam Holmberg Mar 08 '17 at 18:53
  • transcribing the code in the screenshot so that if the screenshot is lost we have the code issue. Looks like unicode – Nate Anderson Mar 09 '17 at 04:50

1 Answers1

0

Possible reason: your cqlsh path is /usr/local/bin/cqlsh which may installed by pip. (check which cqlsh with command $ which cqlsh)

Solution: use Cassandra shipped /usr/bin/cqlsh to connect your Cassandra node with the command:

$ /usr/bin/cqlsh <ip>

Then query to check the result, the prefix 'u' will disappear.

Jingchao Luan
  • 411
  • 4
  • 10