From e061eb02dfcb53d31e6729d8423c97b5ab2fe9bb Mon Sep 17 00:00:00 2001 From: Tomasz Grabiec Date: Thu, 11 Feb 2016 13:58:27 +0100 Subject: [PATCH] cql3: Avoid using partition_key::from_bytes() serialize() and from_bytes() is a low level interface, which in this case can be replaced with a partition_key static factory method resulting in cleaner code. --- cql3/functions/token_fct.hh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cql3/functions/token_fct.hh b/cql3/functions/token_fct.hh index 2dce143d32..c1cc54a7ec 100644 --- a/cql3/functions/token_fct.hh +++ b/cql3/functions/token_fct.hh @@ -62,9 +62,8 @@ public: } bytes_opt execute(serialization_format sf, const std::vector& parameters) override { - auto buf = _schema->partition_key_type()->serialize_optionals(parameters); - auto view = partition_key_view::from_bytes(std::move(buf)); - auto tok = dht::global_partitioner().get_token(*_schema, view); + auto key = partition_key::from_optional_exploded(*_schema, parameters); + auto tok = dht::global_partitioner().get_token(*_schema, key); warn(unimplemented::cause::VALIDATION); return dht::global_partitioner().token_to_bytes(tok); }