From cf40a1538b2c80776e3f2bdc6c75f239689bc890 Mon Sep 17 00:00:00 2001 From: Nikolai Kochetov Date: Wed, 13 Feb 2019 19:49:13 +0300 Subject: [PATCH] Fix size() and empty() for AggregationDataWithNullKey. #4223 --- dbms/src/Interpreters/Aggregator.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dbms/src/Interpreters/Aggregator.h b/dbms/src/Interpreters/Aggregator.h index c4ffb64a15..87febbc77e 100644 --- a/dbms/src/Interpreters/Aggregator.h +++ b/dbms/src/Interpreters/Aggregator.h @@ -98,6 +98,18 @@ struct AggregationDataWithNullKey : public Base AggregateDataPtr & getNullKeyData() { return null_key_data; } bool hasNullKeyData() const { return has_null_key_data; } const AggregateDataPtr & getNullKeyData() const { return null_key_data; } + size_t size() const { return Base::size() + (has_null_key_data ? 1 : 0); } + bool empty() const { return Base::empty() && !has_null_key_data; } + void clear() + { + Base::clear(); + has_null_key_data = false; + } + void clearAndShrink() + { + Base::clearAndShrink(); + has_null_key_data = false; + } private: bool has_null_key_data = false; -- GitLab