2013-05-27 51 views
0

我想在CQLSH中創建一個表,然後在CLI中訪問它(只是爲了看看如何去做)。雖然這對varchar列工作正常,但我在使用int列時遇到了問題。Cassandra CLI - 獲取整數列值

我列族在CSQLSH創建:

創建表的用戶(用戶ID VARCHAR主鍵,年齡INT,isactive INT);

我然後插入一行:

insert into user (userid, age, isactive) values('mj',31,1); 

現在我切換到命令行,可以看到價值,當我使用清單,或是隻運行「讓用戶[‘MJ’]」:

[[email protected]] get user['mj']; 
=> (column=, value=, timestamp=1369665807675000) 
=> (column=age, value=31, timestamp=1369665807675000) 
=> (columnisactive, value=1, timestamp=1369665807675000) 
Returned 3 results. 
Elapsed time: 5.7 msec(s). 

但是,當我嘗試訪問歲整數專欄中,我得到這個錯誤:

[[email protected]] get user['mj']['age'] as Int32Type; 
Not enough bytes to read value of component 0 
InvalidRequestException(why:Not enough bytes to read value of component 0) 
    at org.apache.cassandra.thrift.Cassandra$get_result.read(Cassandra.java:6592) 
    at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:78) 
    at org.apache.cassandra.thrift.Cassandra$Client.recv_get(Cassandra.java:556) 
    at org.apache.cassandra.thrift.Cassandra$Client.get(Cassandra.java:541) 
    at org.apache.cassandra.cli.CliClient.executeGet(CliClient.java:729) 
    at org.apache.cassandra.cli.CliClient.executeCLIStatement(CliClient.java:216) 
    at org.apache.cassandra.cli.CliMain.processStatementInteractive(CliMain.java:210) 
    at org.apache.cassandra.cli.CliMain.main(CliMain.java:337) 

請有人可以提供一些線索這光?

回答