tarantool / tarantool/tarantool
Interval comparison is weird
Open
@Mons is already working on this.
Since Sep 8, 2022.
bug
datetime
- Dominant language
- Lua
- Stars
- 3.7k
- Forks
- 419
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 88
Description
Bug description
Datetime interval type comparison yield counter-intuitive results.
- OS: Linux
- OS Version: Ubuntu 20.04
- Architecture: amd64
Tarantool 2.10.1-0-g482d91c66
Steps to reproduce
tarantool> datetime.interval.new{hour=1} == datetime.interval.new{hour=1}
---
- true
...
tarantool> datetime.interval.new{hour=1} == datetime.interval.new{min=60}
---
- false
...
tarantool> datetime.interval.new{hour=1} > datetime.interval.new{min=60}
---
- true
...
tarantool> datetime.interval.new{hour=1} < datetime.interval.new{min=60}
---
- false
...
tarantool> datetime.interval.new{hour=1} < datetime.interval.new{min=61}
---
- false
...
Expected behavior
Simple approach to == comparison is rather understandable, but >, <, >=, <= is really confusing. @ImeevMA said that intervals are not designed to be comparable by nature, so maybe it's worth to forbid using compare operators in Lua.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.