mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-12 19:02:12 +00:00
types: fix date_type_impl::less() (timestamp cql type)
date_type_impl::less() invokes `compare_unsigned()` to compare the underlying raw byte values. `compared_unsigned()` is a tri comparator, however `date_type_impl::less()` implicitely converted the returned value to bool. In effect, `date_type_impl::less()` would *always* return `true` when the two compared values were not equal. Found while working on a unit test which empoly a randomly generated schema to test a component. Fixes #4419. Signed-off-by: Botond Dénes <bdenes@scylladb.com> Message-Id: <8a17c81bad586b3772bf3d1d1dae0e3dc3524e2d.1554907100.git.bdenes@scylladb.com>
This commit is contained in:
2
types.cc
2
types.cc
@@ -589,7 +589,7 @@ public:
|
||||
return make_value(db_clock::time_point(db_clock::duration(tmp)));
|
||||
}
|
||||
virtual bool less(bytes_view b1, bytes_view b2) const override {
|
||||
return compare_unsigned(b1, b2);
|
||||
return compare_unsigned(b1, b2) < 0;
|
||||
}
|
||||
virtual bool is_byte_order_comparable() const override {
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user