0

I am querying a simple feature type schema: 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'

with the query expression: 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.

but it throws an exception saying Encountered "t" at line 1, column 195.

Here is my exception log detail:

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)

I am not able to determine, why it's throwing an exception on querying with the attribute named t. Whereas if I remove attribute t from the query, it works as expected. Is t a reserved key? or I am missing something.

Suresh Prajapati
  • 3,991
  • 5
  • 26
  • 38
  • I just tried this ECQL.toFilter("t = 44.786507") and it throws basically the same exception. There may be a bug in the (E)CQL parser... – GeoJim May 06 '17 at 22:19

1 Answers1

1

Ok, this is a limitation in the ECQL query parser. The letter 't' by itself (ignoring case) is the UTC token.

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

The options are to work with the GeoTools team to fix this corner case or pick a different attribute name. Nice find!

GeoJim
  • 1,320
  • 7
  • 12
  • I've filed a bug report so this doesn't get lost https://osgeo-org.atlassian.net/browse/GEOT-5722 – Ian Turton May 07 '17 at 09:38
  • @iant thanks for filling the bug report. Do the double quotes treat t as an attribute or a literal? I was only thinking of using single quotes (which would do the wrong thing). – GeoJim May 08 '17 at 13:10
  • 1
    double quotes force an attribute while singe force a literal – Ian Turton May 08 '17 at 13:22