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 /conf/basic-cql2/logical #792

Merged
merged 1 commit into from Feb 20, 2023
Merged

Update /conf/basic-cql2/logical #792

merged 1 commit into from Feb 20, 2023

Conversation

cportele
Copy link
Member

@pvretano @jerstlouis

I have updated the conformance test with the following expression:

            (NOT ({p2}) AND {p1}) OR ({p3} and {p4}) or not ({p1} OR {p4})

 {p1} |  {p2} |  {p3} |  {p4} | (NOT ({p2}) AND {p1}) | ({p3} and {p4})       | not ({p1} OR {p4}))  | result
=============================================================================================================
false | false | false | false |        false          |         false         |        true          | true
false | false | false | true  |        false          |         false         |        false         | false
false | false | true  | false |        false          |         false         |        true          | false
false | false | true  | true  |        false          |         true          |        false         | true
false | true  | false | false |        false          |         false         |        true          | true
false | true  | false | true  |        false          |         false         |        false         | false
false | true  | true  | false |        false          |         false         |        true          | true
false | true  | true  | true  |        false          |         true          |        false         | true
true  | false | false | false |        true           |         false         |        false         | true 
true  | false | false | true  |        true           |         false         |        false         | true 
true  | false | true  | false |        true           |         false         |        false         | true 
true  | false | true  | true  |        true           |         true          |        false         | true
true  | true  | false | false |        false          |         false         |        false         | false
true  | true  | false | true  |        false          |         false         |        false         | false
true  | true  | true  | false |        false          |         false         |        false         | false
true  | true  | true  | true  |        false          |         true          |        false         | true

I have also generated random combinations and computed the number of items matching the filter using https://cql2test.ldproxy.net/ne110m4cql2/collections/ne_110m_populated_places_simple/items.

Closes #768.

@jerstlouis
Copy link
Member

@cportele amazing :) Thank you!

@cportele cportele merged commit ad0d1ee into master Feb 20, 2023
@cportele cportele deleted the issue-768 branch February 20, 2023 06:58
@cportele
Copy link
Member Author

cportele commented Feb 20, 2023

Just in case we need to later, here is the python script that I used to generate the table:

import requests
import json
from random import randrange

predicates = [ "name IS NOT NULL", "name IS NULL", "name='København'", "name>='København'", "name>'København'", "name<='København'", "name<'København'", "name<>'København'", "pop_other IS NOT NULL", "pop_other IS NULL", "pop_other=1038288", "pop_other>=1038288", "pop_other>1038288", "pop_other<=1038288", "pop_other<1038288", "pop_other<>1038288", "start IS NOT NULL", "start IS NULL", "start=TIMESTAMP('2022-04-16T10:13:19Z')", "start<=TIMESTAMP('2022-04-16T10:13:19Z')", "start<TIMESTAMP('2022-04-16T10:13:19Z')", "start>=TIMESTAMP('2022-04-16T10:13:19Z')", "start>TIMESTAMP('2022-04-16T10:13:19Z')", "start<>TIMESTAMP('2022-04-16T10:13:19Z')", "boolean IS NOT NULL", "boolean IS NULL", "boolean=true", "boolean=false" ]

for x in range(0, 75):
    p1 = predicates[randrange(0,27)]
    p2 = predicates[randrange(0,27)]
    p3 = predicates[randrange(0,27)]
    p4 = predicates[randrange(0,27)]
    predicate = '(NOT ({p2}) AND {p1}) OR ({p3} and {p4}) or not ({p1} OR {p4})'.replace('{p1}', p1).replace('{p2}', p2).replace('{p3}', p3).replace('{p4}', p4)
    resp = requests.get('https://cql2test.ldproxy.net/ne110m4cql2/collections/ne_110m_populated_places_simple/items',params={'f':'json', 'filter':predicate})
    numberMatched = resp.json().get('numberMatched')
    print('|`{p1}` |`{p2}` |`{p3}` |`{p4}` |{numberMatched}'.replace('{p1}', p1).replace('{p2}', p2).replace('{p3}', p3).replace('{p4}', p4).replace('{numberMatched}', str(numberMatched)))

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

Successfully merging this pull request may close these issues.

CQL2/AT1.6: {p2} and {p3} contribute nothing to result
3 participants