diff --git a/cql3/functions/aggregate_fcts.hh b/cql3/functions/aggregate_fcts.hh index 4e066a68bd..6e76c88681 100644 --- a/cql3/functions/aggregate_fcts.hh +++ b/cql3/functions/aggregate_fcts.hh @@ -142,20 +142,20 @@ public: virtual void reset() override { _max = {}; } - virtual opt_bytes compute() override { + virtual opt_bytes compute(int protocol_version) override { if (!_max) { return {}; } - return data_type_for().decompose(*_max); + return data_type_for()->decompose(*_max); } virtual void add_input(int protocol_version, const std::vector& values) override { if (!values[0]) { return; } + auto val = boost::any_cast(data_type_for()->compose(*values[0])); if (!_max) { - _max = values[0]; + _max = val; } else { - auto val = boost::any_cast(data_type_for().compose(*values[0])); _max = std::max(*_max, val); } } @@ -179,7 +179,7 @@ public: template shared_ptr make_max_function() { - return shared_ptr>(); + return make_shared>(); } template