简体   繁体   English

SiddhiQL中的语法错误,无关输入(PySiddhi4)

[英]Syntax error in SiddhiQL, extraneous input (PySiddhi4)

I'm trying to use PySiddhi4 to run CEP in a Python-based environment. 我正在尝试使用PySiddhi4在基于Python的环境中运行CEP。 To get acquainted with the package, I tried to run the sample code provided by the Siddhi developers. 为了熟悉该软件包,我尝试运行Siddhi开发人员提供的示例代码。 Here's the link: https://wso2.github.io/PySiddhi/Run-PySiddhi4/ 这是链接: https : //wso2.github.io/PySiddhi/Run-PySiddhi4/

However, when I run the code, I obtain a JavaException error while instantiating siddhiAppRuntime. 但是,当我运行代码时,在实例化siddhiAppRuntime时会遇到JavaException错误。 The siddhiApp query string is as follows: siddhiApp查询字符串如下:

siddhiApp = "define stream cseEventStream (symbol string, price float, volume long); " + \
"@info(name = 'query1') from cseEventStream[volume < 150] select symbol,price insert into outputStream;"

I obtain the following error description: 我获得以下错误描述:

JVM exception occurred: Error between @ Line: 1. Position: 0 and @ Line: 1. Position: 1. Syntax error in SiddhiQL, extraneous input 'iddhiAp' expecting {<EOF>, ';'}.

I tried to play around with the spacing within the query string, but to no avail. 我尝试在查询字符串中使用空格,但无济于事。 Does anyone have a solution to this issue? 有谁能解决这个问题? Thanks a lot in advance! 在此先多谢!

PySiddhi4 is basically a wrapper to Java Siddhi CEP. PySiddhi4基本上是Java Siddhi CEP的包装。 There we use pyjnius [1] module to access Java classes as Python classes using JNI. 在那里,我们使用pyjnius [1]模块使用JNI将Java类作为Python类进行访问。 However, it seems that there's this string encoding issue [2], [3] reported with (the released version of) pyjnius, and that causes the above issue. 但是,似乎存在此字符串编码问题[2],[3]与pyjnius(的发行版本)一起报告,这导致了上述问题。

So according to them, the workarounds are; 因此,根据他们的说法,解决方法是:

  1. Build pyjnius 1.1.1 with cython<0.2.7 (pip install cython==0.26) 使用cython <0.2.7构建pyjnius 1.1.1(pip install cython == 0.26)
  2. Clone the latest version of pyjnius from GitHub, which had fixed the bug but is not released yet. 从GitHub克隆pyjnius的最新版本,该版本已修复该错误,但尚未发布。

Please try that and see. 请尝试看看。 Do let us know if the workaround doesn't seem to be working, then we can try to fix it on PySiddhi itself. 让我们知道如果解决方法似乎不起作用,那么我们可以尝试在PySiddhi本身上修复它。

[1] https://github.com/kivy/pyjnius [1] https://github.com/kivy/pyjnius

[2] https://github.com/kivy/pyjnius/issues/300 [2] https://github.com/kivy/pyjnius/issues/300

[3] https://github.com/kivy/pyjnius/issues/340 [3] https://github.com/kivy/pyjnius/issues/340

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM