Fix size() and empty() for AggregationDataWithNullKey. #4223

This commit is contained in:
Nikolai Kochetov 2019-02-13 19:49:13 +03:00
parent 0bf4f4334b
commit cf40a1538b

View File

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