google / google/badwolf

"BETWEEN start_date, end_date" should return an error if "start_date > end_date"

Open
#140 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
984
Forks
65
PR merge metrics
No merged PRs in 30d

Description

When using the `BETWEEN` keyword, if a sloppy user miswrite the start date in a way it becomes a date past the given end date of that interval, BW should return an error warning the user about it instead of silently returning an empty result (as it is the case nowadays, which is a little misleading).

To illustrate, given the query below:

```
SELECT ?p, ?o
FROM ?test
WHERE {
/u ?p ?o
}
BETWEEN 2016-04-01T00:00:00-08:00, 2016-02-01T00:00:00-08:00;
```

And a `?test` graph with triples:

```
/u "bought"@[2016-01-01T00:00:00-08:00] /c
/u "bought"@[2016-03-01T00:00:00-08:00] /c
```

The query nowadays just silently returns an empty result:

```
Result:
OK
```

Which can be misleading for the user as it will make she believe that the given interval is valid and there are no triples in the `?test` graph satisfying it, whereas the truth is that the typed interval is not valid (which should be pointed as an error) as the user miswrote something while typing it.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.