geotools 过滤器 CQLException:遇到 "t"

geotools filter CQLException: Encountered "t"

我正在查询一个简单的要素类型模式: r:Long:index=join,*g:Point:srid=4326,di:Integer:index=join,al:Float,s:Float,b:Float,an:Float,he:Float,ve:Float,t:Float,m:Boolean,i:Boolean,ts:Long;geomesa.table.sharing='true',geomesa.indices='attr:4:3,records:2:3,z2:3:3',geomesa.table.sharing.prefix='\u0001'

使用查询表达式:r = 31 AND di = 5 AND BBOX(g, -38.857822, -76.111145, -74.64091, -38.61907) AND al <= 39.407307 AND s <= 1.6442835 AND b <= 83.14717 AND an <= 87.0774 AND he <= 40.89476 AND ve <= 88.761566 AND t <= 44.786507 AND m = true AND i = true.

但是它抛出一个异常说 Encountered "t" at line 1, column 195.

这是我的异常日志详细信息:

org.geotools.filter.text.cql2.CQLException: Encountered "t" at line 1, column 195.
Was expecting one of:
    <NOT> ...
    <IDENTIFIER> ...
    "include" ...
    "exclude" ...
    "(" ...
    "[" ...
     Parsing : r = 31 AND di = 5 AND BBOX(g, -38.857822, -76.111145, -74.64091, -38.61907) AND al <= 39.407307 AND s <= 1.6442835 AND b <= 83.14717 AND an <= 87.0774 AND he <= 40.89476 AND ve <= 88.761566 AND t <= 44.786507 AND m = true AND i = true.
    at org.geotools.filter.text.cql2.CQLCompiler.compileFilter(CQLCompiler.java:106)
    at org.geotools.filter.text.commons.CompilerUtil.parseFilter(CompilerUtil.java:196)
    at org.geotools.filter.text.cql2.CQL.toFilter(CQL.java:134)
    at org.geotools.filter.text.cql2.CQL.toFilter(CQL.java:113)
    at com.hps.GeomesaClient.query(GeomesaClient.java:134)
    at com.hps.Reader.run(Reader.java:69)
    at java.lang.Thread.run(Thread.java:745)

我无法确定为什么在使用名为 t 的属性进行查询时抛出异常。而如果我从查询中删除属性 t,它会按预期工作。 t 是保留键吗?或者我遗漏了什么。

好的,这是 ECQL 查询解析器的一个限制。字母 't' 本身(忽略大小写)是 UTC 令牌。

https://github.com/geotools/geotools/blob/master/modules/library/cql/src/main/jjtree/ECQLGrammar.jjt#L180-L187

选项是与 GeoTools 团队合作修复此极端情况或选择不同的属性名称。不错的发现!