Update CASEI implementation to support LIKE#142
Conversation
|
@tomkralidis This PR should fix the issues caught by pygeoapi. There's still one bug in the CI which I'll also mention on geopython/pygeoapi#2018 -- the CROSSES in the test case needs to be updated to S_CROSSES instead. |
| evaluate(db_session, "CASEI(strAttribute) NOT LIKE CASEI('aaa')", ("B", ), None, parse_cql_text) | ||
|
|
||
| def test_casei_in(db_session): | ||
| evaluate(db_session, "CASEI(strAttribute) IN (CASEI('aaa'), CASEI('bbb'))", ("A", "B", ), None, parse_cql_text) |
There was a problem hiding this comment.
There are no changes here that impact how IN requests work, but I figured it was worth confirming given we ran into bugs with LIKE and NOT LIKE
| def test_casei_function(): | ||
| result = parse("CASEI(provider) = 'coolsat'") | ||
| def test_casei_equals(): | ||
| result = parse("CASEI(provider) = CASEI('coolsat')") |
There was a problem hiding this comment.
The standard mentions that implementations can choose to fold either to upper or lower case, so users are required to apply CASEI to both the attribute and the literal to guarantee correct results. It would be allowed for pygeofilter to start using upper instead of lower in the future, for instance.
|
Actually, sorry, I think I pinged too soon -- I want to fix pygeoapi CI before I treat this as solved. Converting to draft and I'll re-ping when I think this is ready. |
|
Turns out all the necessary changes were in pygeoapi -- this change should be ready for review. |
This PR updates the Lark grammar for CQL2 Text and adds tests for both CQL2 text and JSON to make CASEI work appropriately on the right-hand side of LIKE statements.