me.prettyprint.hector.api.exceptions.HInvalidRequestException:InvalidRequestException(输入不匹配'('期待')')

时间:2013-11-11 13:19:17

标签: cassandra cql hector cassandra-cli cqlsh

我试图在表'standardevents'中插入一些值。这是执行的查询。

    UUID uuid=new UUID();
    CqlQuery<String,String,String> cqlQuery = new CqlQuery<String,String,String>(keyspace, stringSerializer, stringSerializer, stringSerializer);   
    cqlQuery.setQuery("INSERT INTO standardevents (UUID,time, tracker, type, name, userID, data) VALUES ("+uuid+",dateof(now()),'"+sessId+"', '"+type+"','"+name+"', '"+userid+"','"+data+"')");
    QueryResult<CqlRows<String,String,String>> result = cqlQuery.execute();     

我在执行之前打印查询,我得

INSERT INTO standardevents (UUID,time, tracker, type, name, userID, data) VALUES (e1319140-4acd-11e3-8015-842b2bab8f61,dateof(now()),'B2FD2CF496E31EC75C33F7A3D55BB800', 'user','coursepage_view', '81','{"courseID":68,"courseDesc":"Quick Start"}')

执行后我得到了一个例外

     me.prettyprint.hector.api.exceptions.HInvalidRequestException:
InvalidRequestException(why:line 1:125 mismatched input '(' expecting ')')

但是,当我在cqlsh客户端中运行此查询时,会插入值。 提前致谢。

1 个答案:

答案 0 :(得分:1)

Hector的CQL支持不足和错误。您应该使用本机CQL Java驱动程序:https://github.com/datastax/java-driver