-
Notifications
You must be signed in to change notification settings - Fork 37
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
Ambiguity in filter for value vs. value comparisons of type string vs. string #157
Comments
I see @rartino's point. I interpret the current specification as requiring to interpret strings as timestamps only in comparisons with timestamp-typed property:
Therefore, the following comparison evaluates to
|
This sounds good. There might be problems, however, if at some point we decide to introduce both math operations ( |
This is exactly as I would interpret it :) |
Indeed, this is a problem that using quotes solves once and for all. |
As a short wrap-up: I would compare value-with-value always as a string, and only recognise literal string values as time-stamps when actually comparing them with a time-stamp properties. Actually, the ISO timestamps are designed in such a way that a full time-stamp lexicographic comparison gives correct chronological order. Thus surprises should be minimal :) |
Couldn't agree more :)
You probably mean the UTC times, because timestamps with offsets ( |
Yes, that's true; the alphabetic comparison apparently gives chronological order only when strings are in the same time zone... |
Right, that was the point of my example:
So, lexicographically the first one is smaller, time-wise the first one is larger. My other point is: is it thus our intent to ONLY provide a facility for value vs. value comparisons for those types who have their own lexiographic tokens (i.e., presently strings and numbers), but not for other property types, e.g., timestamps? Does the good arguments put forward for allowing value vs. value comparisons not apply also for timestamp value vs. value comparisons? What worries me is that we are essentially building in a "gotcha" in the filter language for client implementations:
|
I did some further thinking about this. How about that we for v1.0 simply forbid all string vs string value comparisons, while we keep value vs. value comparisons of other types. Because, as is noted above, it isn't clear what "2019-07-14T22:06:43-01:00" < "2019-07-14T22:06:43Z" should evaluate to. Then, moving on after v1.0, here is where I'd like us to go:
This seems very expandable for embedding any kind of data into string-like tokens in the language in the future. Edit: we can even, from day one, allow database-specific data types with their own semantics! E.g.:
can be allowed from day one!, with comparison semantics defined by my database. |
Could the square bracket syntax be replaced with function-like syntax? I.e., instead of
one would write
This would be similar to |
Recent changes introduced a timestamp type. Timestamps in the filtering language are right now represented as string tokens (parsed according to rfc3339). At the same time value vs. value comparisons are optionally allowed to be supported.
It seems to me that this presents an ambiguity in the interpretation of "value (string) vs. value (string)" comparisons. They can either be parsed as string comparisons, or as timestamp comparisons. E.g., does this filter match or not?:
"2019-07-14T22:06:43-01:00" < "2019-07-14T22:06:43Z"
One solution to this issue is to change the spec so that timestamps have their own token in the filter language. A proposal is to use bare rfc3339 strings, i.e.: 2019-07-14T22:06:43-01:00
Some relevant discussion from #144
@sauliusg wrote:
@rartino replied
The text was updated successfully, but these errors were encountered: