mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-28 04:06:59 +00:00
cql3: fix max() function
Registration was done with a null shared_ptr<> instead of make_shared(), and as a result the max template wasn't even instantiated, so it did not even build.
This commit is contained in:
@@ -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<Type>().decompose(*_max);
|
||||
return data_type_for<Type>()->decompose(*_max);
|
||||
}
|
||||
virtual void add_input(int protocol_version, const std::vector<opt_bytes>& values) override {
|
||||
if (!values[0]) {
|
||||
return;
|
||||
}
|
||||
auto val = boost::any_cast<Type>(data_type_for<Type>()->compose(*values[0]));
|
||||
if (!_max) {
|
||||
_max = values[0];
|
||||
_max = val;
|
||||
} else {
|
||||
auto val = boost::any_cast<Type>(data_type_for<Type>().compose(*values[0]));
|
||||
_max = std::max(*_max, val);
|
||||
}
|
||||
}
|
||||
@@ -179,7 +179,7 @@ public:
|
||||
template <typename Type>
|
||||
shared_ptr<aggregate_function>
|
||||
make_max_function() {
|
||||
return shared_ptr<max_function_for<Type>>();
|
||||
return make_shared<max_function_for<Type>>();
|
||||
}
|
||||
|
||||
template <typename Type>
|
||||
|
||||
Reference in New Issue
Block a user