【问题标题】:me.prettyprint.hector.api.exceptions.HInvalidRequestException: InvalidRequestException(mismatched input '(' expecting ')')me.prettyprint.hector.api.exceptions.HInvalidRequestException:InvalidRequestException(不匹配的输入'('期待')')
【发布时间】:2013-11-23 07:36:03
【问题描述】:

我正在尝试在表“标准事件”中插入一些值。这是执行的查询。

    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 客户端运行此查询时,会插入值。 提前致谢。

【问题讨论】:

  • 您能添加您的表格描述吗?还有你的 Cassandra 和 Hector 版本。
  • 我的表描述是,UUID timeuuid PRIMARY KEY,time timestamp,tracker varchar,type varchar,name varchar,userID varchar,data varchar。我正在使用 Cassandra 版本 1.2.2 和 hector-core-1.1
  • 你使用的是 hector-core 1.1-4 吗?

标签: cassandra cql hector cassandra-cli cqlsh


【解决方案1】:

Hector 的 CQL 支持不佳且存在缺陷。您应该改用本机 CQL Java 驱动程序:https://github.com/datastax/java-driver

【讨论】:

    猜你喜欢
    • 2021-12-07
    • 2021-12-10
    • 2021-10-19
    • 1970-01-01
    • 1970-01-01
    • 2014-02-03
    • 1970-01-01
    • 2022-12-29
    • 2023-03-30
    相关资源
    最近更新 更多