developmentseed / developmentseed/cql2-rs
Temporal methods conversion to sql not working
- Dominant language
- Rust
- Stars
- 23
- Forks
- 3
- Avg merge
- 5h 2m
- Merged PRs (30d)
- 7
Description
Hello,
Since the release of the version `0.6.0`, some temporal methods seem to face issues.
Here are the two examples I found but it may have issues with other method(s).
- `t_overlaps()`:
```sh
$ cql2 "t_overlaps(datetime, INTERVAL('2020-06-01T00:00:00Z','2021-06-01T00:00:00Z'))" -o sql
(datetime < CAST('2020-06-01T00:00:00Z' AS TIMESTAMP WITH TIME ZONE) AND CAST('2020-06-01T00:00:00Z' AS TIMESTAMP WITH TIME ZONE) < datetime AND datetime < CAST('2021-06-01T00:00:00Z' AS TIMESTAMP WITH TIME ZONE))
```
- `t_overlappedby()`:
```sh
$ cql2 "t_overlappedby(datetime, INTERVAL('2020-06-01T00:00:00Z','2021-06-01T00:00:00Z'))" -o sql
(CAST('2020-06-01T00:00:00Z' AS TIMESTAMP WITH TIME ZONE) < datetime AND datetime < CAST('2021-06-01T00:00:00Z' AS TIMESTAMP WITH TIME ZONE) AND CAST('2021-06-01T00:00:00Z' AS TIMESTAMP WITH TIME ZONE) < datetime)
```
In both examples, two opposite conditions are linked by `AND` so `True` can not be got.
A friendly reminder of the way these methods must be understood: [t_overlaps()](https://www.w3.org/TR/owl-time/#time:intervalOverlaps) and [t_overlappedby()](https://www.w3.org/TR/owl-time/#time:intervalOverlappedBy)
Contributor guide
Research direction
Start with the cql2 CLI path for converting temporal methods to SQL, using the t_overlaps() and t_overlappedby() examples as reproductions. Compare the generated conditions with the linked OWL-Time definitions and add coverage for both methods. Done means the opposite interval conditions are no longer combined with AND, and the SQL reflects the intended semantics.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, sql
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100