Update examples ...
pvretano opened this issue · 5 comments
With all the recent (and upcoming) changes to CQL2 some of the examples are out of date and need updating. I've created this issue and assigned it to me to do a sweep of the examples to make sure that they align with the current state of the text in the standard.
I came here to create an issue about the examples, so I hope this is all valuable input for this ticket instead. I have been working on a new parser and ran into several issues with the examples.
example02.txt
: UsesWILDCARD '#'
which is not in the current spec.example08.txt
: Has'HH+VV+HV+VH'
which is probably intended as a character literal but+
is\x002B
and not inalpha
as an acceptable character. This seems like it would actually be useful, and may be a spec issue?example20.txt
-example22.txt
: Have dates in"
rather than'
It would be very helpful if the text examples were directly parseable like the json is. They all contain explanations at the top which prevents reading them in as input without modifying them. A centralized readme with the explanations in a table would be a nice alternative. And several of the text files include alternatives within the file whereas the json is split apart into a and b files.
It would also be extremely useful for testing new implementations to have more official examples. There are many things that they don't cover and most are very simple. I think these would be nice to have:
- Comparisons
<>
or>=
NOT BETWEEN
NOT IN
IS NULL
/IS NOT NULL
- Has 2 of 8 spatial operators
- Has 2 of 8 WKT
- Has 3 of 15 temporal operators
- A timestamp instant.
- All the array operators
- More complex identifiers with
_
,.
, digits, and non ascii letters - A
function
that isn't one of the defined operators - Character literal with an escaped quote
- Boolean literal
- Arithmetic
If I can contribute anything useful here I am willing to help out as well. I am going to attempt to automatically generate some additional tests myself, but I am not sure how useful they may be to others. Their intent will be coverage on the grammar and not necessarily make any practical sense.
Meeting 2023-02-15: @pvretano is working on a pull request and merge it once it is done.
@eseglem - if you have examples, please send them to pvretano@cubewerx.com and he will include them, many thanks!
@cportele I have not generated much that is useful yet but I am still working on it. The first attempt was very naive and produced a lot of useless examples. Technically valid within the schemas but not actually usable. If / when I end up with anything useful I will share it.
Meeting 2023-02-27: @pvretano is working on the PR and also adds additional examples so that we cover all aspects. The goal is to have it ready by the next meeting.
Finally got my parser to a spot I felt comfortable putting it out there. Its here: https://github.com/eseglem/pycql2 Its still a work in progress but I have 57 examples so far in tests/data/
. Based on coverage, they should be touching the major parts of the grammar at least once. I will still be be adding additional, more complex, examples but wanted to put it out there if they are of any help. @pvretano
These were mostly hand generated, with some randomization of parts. No auto generation yet, but that is still in the plans. As I mentioned before, I was aiming for coverage, and not necessarily making things completely logical. I did attempt not to do anything too weird but wasn't worried about property names or exact values making much sense. For example the geometries should mostly be valid GeoJSON but may not be 'valid' in the sense that they could self intersect and things like that.