Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CQL2 to the finalized specification #10

Closed
aaime opened this issue Nov 4, 2024 · 4 comments
Closed

Update CQL2 to the finalized specification #10

aaime opened this issue Nov 4, 2024 · 4 comments
Assignees

Comments

@aaime
Copy link
Member

aaime commented Nov 4, 2024

If we want to have CQL2 filtering as part of the extension we'll have to update the GeoTools implementation of cql2-text and cql2-json to support the finalized specification.

I cannot find a CITE test, but the ATS for the specification assumes a specific version of Natural Earth 110 million that is delivered as a 1MB GeoPackage, and provides many sample filters with the expected amount of matching features.

A few notes:

  • It's a ton of tests
  • The examples are given only as cql2-text (not cql2-json)
  • We don't support all the conformance classes (e.g., don't support accent removal for example, nor array comparison
  • Adding a 1MB payload in our git repositories is a bit big ... maybe it could be an online test downloading the test data on demand (1MB download is not that much).
  • JSON schema for tests is here
  • Supporting CASEI/ACCENTI/array comparisons, and more in general, anything that is not in our existing filtering model, is considered a stretch goal, only to be worked on at the end.
@aaime aaime converted this from a draft issue Nov 4, 2024
pmauduit added a commit to pmauduit/geotools that referenced this issue Nov 5, 2024
pmauduit added a commit to pmauduit/geotools that referenced this issue Nov 6, 2024
@pmauduit
Copy link
Collaborator

pmauduit commented Nov 6, 2024

I created a working branch for the test, which adds 330 tests on each modules (cql2-text & cql2-json), I also renamed the former ENVELOPE keyword to the expected BBOX one, current diff against main is here:
geotools/geotools@main...pmauduit:geotools:cql2-text-conformance-testsuite

As for now,

  • 205 out of the 330 tests pass on cql2-text
  • 184 out of 330 on cql2-json

in its current implementation, geotools is not able to parse some of the provided filters, as a result we cannot translate them into json version of the filter. For these ones I am currently using an empty json object as input for the test, which will make the test fail.

I am confused by some of the expected results provided by the spec though, the following filter is expected to return 2 features:

"date"<>DATE('2022-04-16')

Our tests is returning more than that because on the NaturalEarth dataset, a lot of dates are left empty (NULL). Considering that NULL is different from the '2022-04-16' date, we also should return the elements having a NULL date, contrary to what the specifications currently state in table 7 of https://docs.ogc.org/is/21-065r2/21-065r2.html#_conformance_test_8. I will open an issue onto the dedicated OGC repository to clarify this.

@pmauduit
Copy link
Collaborator

pmauduit commented Nov 7, 2024

Setting the TZ=GMT environment variable (honoured by the libsqlite-C implementation used by xerial's sqlite-jdbc java library, used by geotools to access the geopackage), it gives:

  • gt-cql2-text: 231 tests / 330
  • gt-cql2-json: 210 / 330

aaime added a commit to geotools/geotools that referenced this issue Nov 14, 2024
* implements the ATS conformance testsuite

See geoserver/geoserver-ogcapi#10
for the motivation.

* renaming ENVELOPE to BBOX to comply with the updated specs

* generating a testjar, relax members on test classes

protected instead of private in order to allow customizations into
extended classes, preparing reuse of the testsuite into the json version
of the module.

* porting the conformance testsuite to cql2-json module

* forcing TZ to GMT when calling tests

This is needed by the geopkg module which relies on libsqlite C
implementation (which in turn honour the "TZ" env variable).

* Allow 3 way logic evaluation via datastore hint. Centralized test execution code (Andrea Aime)

* Correctly parse dateline spanning envelopes (Andrea Aime)

* Adding support for extra arithmetic operators, %, ^ and div (Andrea Aime)

* adding 2 missing tables to the CQL2 conformance testsuite

Note: @ignored because not implemented right now anyway.

* commenting out tests inputs which aren't implemented

* cql2-json - realigning with cql2-text conformance testsuite

* adding json schema validation tests

* cql2-json - fixing PMD issues (no wildcard imports)

* taking into account feedback from PR

---------

Co-authored-by: aaime <[email protected]>
@groldan groldan closed this as completed by moving to Done in OGC API graduation code sprint Nov 14, 2024
@groldan
Copy link
Member

groldan commented Nov 14, 2024

@pmauduit @aaime moved this ticket to the done column, as merged on geotools/geotools@e58d016
Let me know if there's something else to do for it

@aaime
Copy link
Member Author

aaime commented Nov 15, 2024

See the draft graduation e-mail for a list of functionality that could be addressed by expanding the javacc parser (and eventually implementing functions to support missing filters):
#18 (comment)

However, IMHO, it's time to focus on shipping rather than continue to implement new stuff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

3 participants