Documentation wrongly reports "IN" ECQL predicates to accept expression on the left side

Description

Including a cql_filter with arithmetic expression before IN function (i.e. PERSONS/10 IN (247757.4)) results in a parsing error. The resulting map should just show Kansas as PERSONS IN (244574) matches that.

Request:
http://localhost:8080/geoserver/wms?service=WMS&version=1.1.0&request=GetMap&layers=topp:states&styles=&bbox=-124.73142200000001,24.955967,-66.969849,49.371735&width=768&height=330&srs=EPSG:4326&format=application/openlayers&cql_filter=(PERSONS/10)%20IN%20(247757.4)

Error:
<?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE ServiceExceptionReport SYSTEM "http://localhost:8080/geoserver/schemas/wms/1.1.1/WMS_exception_1_1_1.dtd"> <ServiceExceptionReport version="1.1.1" > <ServiceException>
Could not parse CQL filter list.
Encountered &quot;/ 10 ) IN&quot; at line 1, column 9.
Was expecting one of:
&quot;(&quot; ...
&quot;:&quot; ...
&lt;IDENTIFIER&gt; ...
&quot;.&quot; ...
&quot;*&quot; ...
&quot;/&quot; &quot;(&quot; ...
&quot;/&quot; &quot;[&quot; ...
&quot;/&quot; &lt;IDENTIFIER&gt; ...
&quot;/&quot; &lt;DATE&gt; ...
&quot;/&quot; &lt;DATE_TIME&gt; ...
&quot;/&quot; &quot;-&quot; ...
&quot;/&quot; &lt;INTEGER_LITERAL&gt; &quot;*&quot; ...
&quot;/&quot; &lt;INTEGER_LITERAL&gt; &quot;/&quot; ...
&quot;/&quot; &lt;INTEGER_LITERAL&gt; &quot;+&quot; ...
&quot;/&quot; &lt;INTEGER_LITERAL&gt; &quot;-&quot; ...
&quot;/&quot; &lt;INTEGER_LITERAL&gt; &quot&quot; &quot;*&quot; ...
&quot;/&quot; &lt;INTEGER_LITERAL&gt; &quot&quot; &quot;/&quot; ...
&quot;/&quot; &lt;INTEGER_LITERAL&gt; &quot&quot; &quot;+&quot; ...
&quot;/&quot; &lt;INTEGER_LITERAL&gt; &quot&quot; &quot;-&quot; ...
&quot;/&quot; &lt;INTEGER_LITERAL&gt; &quot&quot; &quot;not&quot; ...
&quot;/&quot; &lt;INTEGER_LITERAL&gt; &quot&quot; &quot;like&quot; ...
&quot;/&quot; &lt;INTEGER_LITERAL&gt; &quot&quot; &quot;ilike&quot; ...
&quot;/&quot; &lt;INTEGER_LITERAL&gt; &quot&quot; &quot;exists&quot; ...
&quot;/&quot; &lt;INTEGER_LITERAL&gt; &quot&quot; &quot;does-not-exist&quot; ...
&quot;/&quot; &lt;INTEGER_LITERAL&gt; &quot&quot; &quot;is&quot; ...
&quot;/&quot; &lt;INTEGER_LITERAL&gt; &quot&quot; &quot;between&quot; ...
&quot;/&quot; &lt;INTEGER_LITERAL&gt; &quot&quot; &quot;=&quot; ...
&quot;/&quot; &lt;INTEGER_LITERAL&gt; &quot&quot; &quot;&gt;&quot; ...
&quot;/&quot; &lt;INTEGER_LITERAL&gt; &quot&quot; &quot;&lt;&quot; ...
&quot;/&quot; &lt;INTEGER_LITERAL&gt; &quot&quot; &quot;&gt;=&quot; ...
&quot;/&quot; &lt;INTEGER_LITERAL&gt; &quot&quot; &quot;&lt;=&quot; ...
&quot;/&quot; &lt;INTEGER_LITERAL&gt; &quot&quot; &quot;&lt;&gt;&quot; ...
&quot;not&quot; ...
&quot;in&quot; ...
&quot;tequals&quot; ...
&quot;before&quot; ...
&quot;after&quot; ...
&quot;during&quot; ...
&quot;/&quot; &lt;INTEGER_LITERAL&gt; &quot;not&quot; ...
&quot;/&quot; &lt;INTEGER_LITERAL&gt; &quot;like&quot; ...
&quot;/&quot; &lt;INTEGER_LITERAL&gt; &quot;ilike&quot; ...
&quot;/&quot; &lt;INTEGER_LITERAL&gt; &quot;exists&quot; ...
&quot;/&quot; &lt;INTEGER_LITERAL&gt; &quot;does-not-exist&quot; ...
&quot;/&quot; &lt;INTEGER_LITERAL&gt; &quot;is&quot; ...
&quot;/&quot; &lt;INTEGER_LITERAL&gt; &quot;between&quot; ...
&quot;/&quot; &lt;INTEGER_LITERAL&gt; &quot;=&quot; ...
&quot;/&quot; &lt;INTEGER_LITERAL&gt; &quot;&gt;&quot; ...
&quot;/&quot; &lt;INTEGER_LITERAL&gt; &quot;&lt;&quot; ...
&quot;/&quot; &lt;INTEGER_LITERAL&gt; &quot;&gt;=&quot; ...
&quot;/&quot; &lt;INTEGER_LITERAL&gt; &quot;&lt;=&quot; ...
&quot;/&quot; &lt;INTEGER_LITERAL&gt; &quot;&lt;&gt;&quot; ...
Parsing : (PERSONS/10) IN (247757.4).
</ServiceException></ServiceExceptionReport>

Environment

Windows 7-64

Activity

Show:
Andrea Aime
September 24, 2017, 8:16 AM

This cannot however be considered a bug, the ECQL syntax is clear that "IN" accepts a list of literals, not expressions, so it's working as inteded and as advertised:
http://docs.geoserver.org/latest/en/user/filter/ecql_reference.html#predicate

That said, allowing expressions in IN can certainly be useful. I've changed the type of request to "improvement".

Katey Bilz
September 25, 2017, 2:23 PM
Edited

The documentation says that expressions are not allowed after the IN clause. This issue is with before the IN clause. The link above defines it as "Expression IN ( Literal { ,Literal } )"

Andrea Aime
September 25, 2017, 2:29 PM

Ah, sorry I misread. This is a documentation bug then, the actual syntax definition in ECQL only allows for attribute names on the left side, see:

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

In particular, "<attribute-name> [ "NOT" ] "IN" <in predicate value>".

Fixed

Assignee

Unassigned

Reporter

Katey Bilz

Triage

None

Fix versions

None

Affects versions

Components

Priority

Medium
Configure