Closed bertt closed 7 years ago
Test readEntitiesWithFilterQO is discussed here: https://github.com/opengeospatial/ets-sta10/issues/37
Description test checkQueriesPriorityOrdering:
Response: { "@iot.count": 9, "@iot.nextLink": "http://localhost:8080/v1.0/Observations?$filter=result gt '3'&$count=true&$orderby=phenomenonTime asc&$top=1&$skip=3", "value": [ { "@iot.id": 30, "@iot.selfLink": "http://localhost:8080/v1.0/Observations(30)", "phenomenonTime": "2015-03-06T00:00:00.000Z", "result": 6, "Datastream@iot.navigationLink": "http://localhost:8080/v1.0/Observations(30)/Datastream", "FeatureOfInterest@iot.navigationLink": "http://localhost:8080/v1.0/Observations(30)/FeatureOfInterest", "resultTime": null } ] }
Test result: The query order of execution is not correct. The expected count is 6, but the service returned 9 expected [6] but found [9] Expected :6 Actual :9
12 observations are posted with the following result values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 Query asks for observations where the result is > 3 = 4, 5, 6, 7, 8, 9, 10, 11, 12 = 9 returned observations. The test is not expecting observations with result 10, 11, 12 to return because of bad comparison on strings
is there an issue on the ets-sta site about this? Or is it the same as opengeospatial/ets-sta10#37
so for my understanding the issue with test 'checkQueriesPriorityOrdering' is as follows:
yes
analysis:
. in the GOST code the query string ('3') is converted to int (3) and then the query is performed, resulting in 9 observations (method int compare)
possible fix: in case of type mismatch (like string in the query, integer in the database) do not convert the query string from '3' to 3, but convert the observation results to string, resulting in 6 observations (method string compare).
Is this possible to do? What are the consequences?
It is possible but result values are inserted as integers, I'm not going to change the code to get faulty tests working. Consequences are that users do not get back the desired things, locations, datastreams, observations, etc
Proposal:
Count query: SELECT COUNT(*) FROM v1.observation WHERE observation.data -> 'result' > '3' Actual result: 9 Expected result: 6
Solution: change query: replace '->' with '->>' SELECT count(*) FROM v1.observation WHERE observation.data ->> 'result' > '3' Actual result: 6
Added a workaround for now. When filtering on observation.result with a string as input the observation.result will be fetched as string and compared
When running STA test 3 I see 2 failing tests:
checkQueriesPriorityOrdering
readEntitiesWithFilterQO
Can we fix these tests?