执行语句时出错:select子句表达式类型的无效null或零元素列表

时间:2016-08-09 09:50:15

标签: esper

我们可以根据特定条件在按需查询中编写更新语句吗? 我正在尝试执行以下查询: 更新istream StockEventWindow set price = 100 where price> 250和id = 10;

但是我得到了以下错误 执行语句时出错:select子句表达式类型的null或零元素列表无效[update istream StockEventWindow set price = 100其中price> 250和id = 10]

我的任务是在收到时间事件后的某个时间间隔内更新价格大于250的事件。

如果有人通过按需使用更新查询的示例提供解决方案,那将会很棒。如果可能,请在按需查询中提供删除命令用法的示例。

我尝试按需更新和删除命令,如esper文档6.10.2和6.10.3(Link)中所述。但这是错误的。

使用删除时出现以下错误: `com.espertech.esper.client.EPStatementSyntaxException:'delete'附近的语法不正确(保留关键字)[从StockEventWindow删除,其中id = 10]     at com.espertech.esper.epl.parse.ExceptionConvertor.convertStatement(ExceptionConvertor.java:40)     在com.espertech.esper.epl.parse.ParseHelper.parse(ParseHelper.java:121)     在com.espertech.esper.core.service.EPAdministratorHelper.compileEPL(EPAdministratorHelper.java:115)     在com.espertech.esper.core.service.EPAdministratorHelper.compileEPL(EPAdministratorHelper.java:88)     在com.espertech.esper.core.service.EPRuntimeImpl.getExecuteMethod(EPRuntimeImpl.java:1456)     在com.espertech.esper.core.service.EPRuntimeImpl.executeQueryInternal(EPRuntimeImpl.java:1414)     在com.espertech.esper.core.service.EPRuntimeImpl.executeQuery(EPRuntimeImpl.java:1407)     在com.cor.cep.handler.Listener.onDemandUpdate(Listener.java:155)     at com.cor.cep.handler.Listener.update(Listener.java:76)     at com.espertech.esper.core.service.StatementResultServiceImpl.dispatchInternal(StatementResultServiceImpl.java:389)     在com.espertech.esper.core.service.StatementResultServiceImpl.processDispatch(StatementResultServiceImpl.java:249)     在com.espertech.esper.core.service.StatementResultServiceImpl.execute(StatementResultServiceImpl.java:235)     在com.espertech.esper.core.service.UpdateDispatchViewBase.execute(UpdateDispatchViewBase.java:75)     在com.espertech.esper.core.service.UpdateDispatchFutureSpin.execute(UpdateDispatchFutureSpin.java:85)     在com.espertech.esper.dispatch.DispatchServiceImpl.dispatchFromQueue(DispatchServiceImpl.java:52)     在com.espertech.esper.dispatch.DispatchServiceImpl.dispatch(DispatchServiceImpl.java:31)     在com.espertech.esper.core.service.EPRuntimeImpl.dispatch(EPRuntimeImpl.java:1238)     在com.espertech.esper.core.service.EPRuntimeImpl.processTimeEvent(EPRuntimeImpl.java:529)     在com.espertech.esper.core.service.EPRuntimeImpl.processEvent(EPRuntimeImpl.java:423)     在com.espertech.esper.core.service.EPRuntimeImpl.sendEvent(EPRuntimeImpl.java:197)     在com.espertech.esper.core.service.EPRuntimeImpl.timerCallback(EPRuntimeImpl.java:171)     在com.espertech.esper.timer.EPLTimerTask.run(EPLTimerTask.java:61)     at java.util.concurrent.Executors $ RunnableAdapter.call(Executors.java:511)     at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)     at java.util.concurrent.ScheduledThreadPoolExecutor $ ScheduledFutureTask.access $ 301(ScheduledThreadPoolExecutor.java:180)     at java.util.concurrent.ScheduledThreadPoolExecutor $ ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)     在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)     at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:617)     在java.lang.Thread.run(Thread.java:745)

当使用更新时,它会给出错误: com.espertech.esper.client.EPStatementSyntaxException: Incorrect syntax near 'StockEventWindow' expecting 'istream' but found an identifier at line 1 column 7 [update StockEventWindow set price = 200 where id = 10] at com.espertech.esper.epl.parse.ExceptionConvertor.convertStatement(ExceptionConvertor.java:40) at com.espertech.esper.epl.parse.ParseHelper.parse(ParseHelper.java:109) at com.espertech.esper.core.service.EPAdministratorHelper.compileEPL(EPAdministratorHelper.java:115) at com.espertech.esper.core.service.EPAdministratorHelper.compileEPL(EPAdministratorHelper.java:88) at com.espertech.esper.core.service.EPRuntimeImpl.getExecuteMethod(EPRuntimeImpl.java:1456) at com.espertech.esper.core.service.EPRuntimeImpl.executeQueryInternal(EPRuntimeImpl.java:1414) at com.espertech.esper.core.service.EPRuntimeImpl.executeQuery(EPRuntimeImpl.java:1407) at com.cor.cep.handler.Listener.onDemandUpdate(Listener.java:155) at com.cor.cep.handler.Listener.update(Listener.java:76) at com.espertech.esper.core.service.StatementResultServiceImpl.dispatchInternal(StatementResultServiceImpl.java:389) at com.espertech.esper.core.service.StatementResultServiceImpl.processDispatch(StatementResultServiceImpl.java:249) at com.espertech.esper.core.service.StatementResultServiceImpl.execute(StatementResultServiceImpl.java:235) at com.espertech.esper.core.service.UpdateDispatchViewBase.execute(UpdateDispatchViewBase.java:75) at com.espertech.esper.core.service.UpdateDispatchFutureSpin.execute(UpdateDispatchFutureSpin.java:85) at com.espertech.esper.dispatch.DispatchServiceImpl.dispatchFromQueue(DispatchServiceImpl.java:52) at com.espertech.esper.dispatch.DispatchServiceImpl.dispatch(DispatchServiceImpl.java:31) at com.espertech.esper.core.service.EPRuntimeImpl.dispatch(EPRuntimeImpl.java:1238) at com.espertech.esper.core.service.EPRuntimeImpl.processThreadWorkQueueLatchedSpin(EPRuntimeImpl.java:870) at com.espertech.esper.core.service.EPRuntimeImpl.processThreadWorkQueue(EPRuntimeImpl.java:778) at com.espertech.esper.core.service.EPRuntimeImpl.processWrappedEvent(EPRuntimeImpl.java:477) at com.espertech.esper.core.service.EPRuntimeImpl.processEvent(EPRuntimeImpl.java:438) at com.espertech.esper.core.service.EPRuntimeImpl.sendEvent(EPRuntimeImpl.java:197) at com.cor.cep.handler.StockEventHandler.handle(StockEventHandler.java:336) at com.cor.cep.util.RandomStockEventGenerator$1.run(RandomStockEventGenerator.java:63) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)

1 个答案:

答案 0 :(得分:1)

有两个APIS,一个用于创建连续查询(createEPL),另一个用于执行即发即弃查询(executeQuery)。最好不要混淆它们。 "更新"是一个连续的查询和更新窗口......"是一个发射后不停的问题。