簡體   English   中英

Cassandra查詢語言無法讀取由Astyanax插入的數據

[英]Cassandra Query Language not read the data inserted by Astyanax

我已經使用Astyanax在Cassandra中插入了數據,但是當我使用CQL3執行以下查詢時,結果為十六進制

select * from employees1;

結果:

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

然后我知道Astyanax也支持CQL,然后使用它並將記錄插入到Cassandra中,然后運行上面的查詢,並成功顯示了如下記錄。

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

為什么CQL3不讀取Astyanax插入的數據? Apache Cassandra不提供標准的實現方式嗎? 背后的游戲是什么?

我是Cassandra的新手。

我有這個確切的問題。 對我來說,問題在於我的表是通過cassandra-cli和bytesType比較器創建為列族的。

在cqlsh中,嘗試以下操作:

describe table employees1;

如果看到類似這樣的內容:

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'};

這意味着您的表是舊式列族。 為了以可讀格式查詢數據(cqlsh),字段必須是除blob之外的其他內容,例如varchar或int。 不幸的是,我認為blob和varchar是不兼容的類型,因此您可能必須重新創建表並重新加載。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM