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:
Botond Dénes
2019-04-10 17:39:07 +03:00
committed by Avi Kivity
parent 90721468f0
commit f201f8abab

View File

@@ -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;