diff --git a/dbms/include/DB/Columns/ColumnAggregateFunction.h b/dbms/include/DB/Columns/ColumnAggregateFunction.h index 983a20dfdb6..16a6649c651 100644 --- a/dbms/include/DB/Columns/ColumnAggregateFunction.h +++ b/dbms/include/DB/Columns/ColumnAggregateFunction.h @@ -113,21 +113,21 @@ public: return res; } - std::string getName() const { return "ColumnAggregateFunction"; } + std::string getName() const override { return "ColumnAggregateFunction"; } - size_t sizeOfField() const { return sizeof(getData()[0]); } + size_t sizeOfField() const override { return sizeof(getData()[0]); } - size_t size() const + size_t size() const override { return getData().size(); } - ColumnPtr cloneEmpty() const - { + ColumnPtr cloneEmpty() const override + { return new ColumnAggregateFunction(holder->func, Arenas(1, new Arena)); }; - Field operator[](size_t n) const + Field operator[](size_t n) const override { Field field = String(); { @@ -137,7 +137,7 @@ public: return field; } - void get(size_t n, Field & res) const + void get(size_t n, Field & res) const override { res = String(); { @@ -146,17 +146,17 @@ public: } } - StringRef getDataAt(size_t n) const + StringRef getDataAt(size_t n) const override { return StringRef(reinterpret_cast(&getData()[n]), sizeof(getData()[n])); } - void insertData(const char * pos, size_t length) + void insertData(const char * pos, size_t length) override { getData().push_back(*reinterpret_cast(pos)); } - void insertFrom(const IColumn & src, size_t n) + void insertFrom(const IColumn & src, size_t n) override { getData().push_back(static_cast(src).getData()[n]); } @@ -167,7 +167,7 @@ public: holder.get()->func.get()->merge(getData().back(), static_cast(src).getData()[n]); } - void insert(const Field & x) + void insert(const Field & x) override { IAggregateFunction * function = holder.get()->func; @@ -177,17 +177,17 @@ public: function->deserializeMerge(getData().back(), read_buffer); } - void insertDefault() + void insertDefault() override { throw Exception("Method insertDefault is not supported for ColumnAggregateFunction.", ErrorCodes::NOT_IMPLEMENTED); } - size_t byteSize() const + size_t byteSize() const override { return getData().size() * sizeof(getData()[0]); } - ColumnPtr cut(size_t start, size_t length) const + ColumnPtr cut(size_t start, size_t length) const override { if (start + length > getData().size()) throw Exception("Parameters start = " @@ -205,7 +205,7 @@ public: return res; } - ColumnPtr filter(const Filter & filter) const + ColumnPtr filter(const Filter & filter) const override { size_t size = getData().size(); if (size != filter.size()) @@ -225,7 +225,7 @@ public: return res; } - ColumnPtr permute(const Permutation & perm, size_t limit) const + ColumnPtr permute(const Permutation & perm, size_t limit) const override { size_t size = getData().size(); @@ -247,22 +247,22 @@ public: return res; } - ColumnPtr replicate(const Offsets_t & offsets) const + ColumnPtr replicate(const Offsets_t & offsets) const override { throw Exception("Method replicate is not supported for ColumnAggregateFunction.", ErrorCodes::NOT_IMPLEMENTED); } - void getExtremes(Field & min, Field & max) const + void getExtremes(Field & min, Field & max) const override { throw Exception("Method getExtremes is not supported for ColumnAggregateFunction.", ErrorCodes::NOT_IMPLEMENTED); } - int compareAt(size_t n, size_t m, const IColumn & rhs_, int nan_direction_hint) const + int compareAt(size_t n, size_t m, const IColumn & rhs_, int nan_direction_hint) const override { return 0; } - void getPermutation(bool reverse, size_t limit, Permutation & res) const + void getPermutation(bool reverse, size_t limit, Permutation & res) const override { size_t s = getData().size(); res.resize(s); diff --git a/dbms/include/DB/Columns/ColumnArray.h b/dbms/include/DB/Columns/ColumnArray.h index 93d349a5e3f..b71a0efed63 100644 --- a/dbms/include/DB/Columns/ColumnArray.h +++ b/dbms/include/DB/Columns/ColumnArray.h @@ -42,19 +42,19 @@ public: } } - std::string getName() const { return "ColumnArray(" + data->getName() + ")"; } + std::string getName() const override { return "ColumnArray(" + data->getName() + ")"; } - ColumnPtr cloneEmpty() const + ColumnPtr cloneEmpty() const override { return new ColumnArray(data->cloneEmpty()); } - size_t size() const + size_t size() const override { return getOffsets().size(); } - Field operator[](size_t n) const + Field operator[](size_t n) const override { size_t offset = offsetAt(n); size_t size = sizeAt(n); @@ -66,7 +66,7 @@ public: return res; } - void get(size_t n, Field & res) const + void get(size_t n, Field & res) const override { size_t offset = offsetAt(n); size_t size = sizeAt(n); @@ -77,7 +77,7 @@ public: data->get(offset + i, res_arr[i]); } - StringRef getDataAt(size_t n) const + StringRef getDataAt(size_t n) const override { /** Работает для массивов значений фиксированной длины. * Для массивов строк и массивов массивов полученный кусок памяти может не взаимно-однозначно соответствовать элементам. @@ -87,7 +87,7 @@ public: return StringRef(begin.data, end.data - begin.data); } - void insertData(const char * pos, size_t length) + void insertData(const char * pos, size_t length) override { /** Аналогично - только для массивов значений фиксированной длины. */ @@ -98,14 +98,17 @@ public: size_t field_size = data_->sizeOfField(); const char * end = pos + length; - for (; pos + field_size <= end; pos += field_size) + size_t elems = 0; + for (; pos + field_size <= end; pos += field_size, ++elems) data_->insertData(pos, field_size); if (pos != end) throw Exception("Incorrect length argument for method ColumnArray::insertData", ErrorCodes::BAD_ARGUMENTS); + + getOffsets().push_back((getOffsets().size() == 0 ? 0 : getOffsets().back()) + elems); } - ColumnPtr cut(size_t start, size_t length) const + ColumnPtr cut(size_t start, size_t length) const override { if (length == 0) return new ColumnArray(data); @@ -138,7 +141,7 @@ public: return res; } - void insert(const Field & x) + void insert(const Field & x) override { const Array & array = DB::get(x); size_t size = array.size(); @@ -147,7 +150,7 @@ public: getOffsets().push_back((getOffsets().size() == 0 ? 0 : getOffsets().back()) + size); } - void insertFrom(const IColumn & src_, size_t n) + void insertFrom(const IColumn & src_, size_t n) override { const ColumnArray & src = static_cast(src_); size_t size = src.sizeAt(n); @@ -159,12 +162,12 @@ public: getOffsets().push_back((getOffsets().size() == 0 ? 0 : getOffsets().back()) + size); } - void insertDefault() + void insertDefault() override { getOffsets().push_back(getOffsets().size() == 0 ? 0 : getOffsets().back()); } - ColumnPtr filter(const Filter & filt) const + ColumnPtr filter(const Filter & filt) const override { size_t size = getOffsets().size(); if (size != filt.size()) @@ -203,7 +206,7 @@ public: return res; } - ColumnPtr permute(const Permutation & perm, size_t limit) const + ColumnPtr permute(const Permutation & perm, size_t limit) const override { size_t size = getOffsets().size(); @@ -241,7 +244,7 @@ public: return res; } - int compareAt(size_t n, size_t m, const IColumn & rhs_, int nan_direction_hint) const final + int compareAt(size_t n, size_t m, const IColumn & rhs_, int nan_direction_hint) const override { const ColumnArray & rhs = static_cast(rhs_); @@ -276,7 +279,7 @@ public: } }; - void getPermutation(bool reverse, size_t limit, Permutation & res) const + void getPermutation(bool reverse, size_t limit, Permutation & res) const override { size_t s = size(); if (limit >= s) @@ -302,18 +305,18 @@ public: } } - void reserve(size_t n) + void reserve(size_t n) override { getOffsets().reserve(n); getData().reserve(n); /// Средний размер массивов тут никак не учитывается. Или считается, что он не больше единицы. } - size_t byteSize() const + size_t byteSize() const override { return data->byteSize() + getOffsets().size() * sizeof(getOffsets()[0]); } - void getExtremes(Field & min, Field & max) const + void getExtremes(Field & min, Field & max) const override { min = Array(); max = Array(); @@ -350,7 +353,7 @@ public: const ColumnPtr & getOffsetsColumn() const { return offsets; } - ColumnPtr replicate(const Offsets_t & replicate_offsets) const + ColumnPtr replicate(const Offsets_t & replicate_offsets) const override { /// Не получается реализовать в общем случае. diff --git a/dbms/include/DB/Columns/ColumnConst.h b/dbms/include/DB/Columns/ColumnConst.h index c97d4207c9a..4d599448b63 100644 --- a/dbms/include/DB/Columns/ColumnConst.h +++ b/dbms/include/DB/Columns/ColumnConst.h @@ -19,7 +19,7 @@ using Poco::SharedPtr; class IColumnConst : public IColumn { public: - bool isConst() const { return true; } + bool isConst() const override { return true; } virtual ColumnPtr convertToFullColumn() const = 0; }; @@ -37,21 +37,21 @@ public: /// Для ColumnConst data_type_ должен быть ненулевым, если тип данных FixedString. ColumnConst(size_t s_, const T & data_, DataTypePtr data_type_ = DataTypePtr()) : s(s_), data(data_), data_type(data_type_) {} - std::string getName() const { return "ColumnConst<" + TypeName::get() + ">"; } - bool isNumeric() const { return IsNumber::value; } - bool isFixed() const { return IsNumber::value; } - size_t sizeOfField() const { return sizeof(T); } - ColumnPtr cloneResized(size_t s_) const { return new ColumnConst(s_, data); } - size_t size() const { return s; } - Field operator[](size_t n) const { return FieldType(data); } - void get(size_t n, Field & res) const { res = FieldType(data); } + std::string getName() const override { return "ColumnConst<" + TypeName::get() + ">"; } + bool isNumeric() const override { return IsNumber::value; } + bool isFixed() const override { return IsNumber::value; } + size_t sizeOfField() const override { return sizeof(T); } + ColumnPtr cloneResized(size_t s_) const override { return new ColumnConst(s_, data); } + size_t size() const override { return s; } + Field operator[](size_t n) const override { return FieldType(data); } + void get(size_t n, Field & res) const override { res = FieldType(data); } - ColumnPtr cut(size_t start, size_t length) const + ColumnPtr cut(size_t start, size_t length) const override { return new ColumnConst(length, data, data_type); } - void insert(const Field & x) + void insert(const Field & x) override { if (x.get() != FieldType(data)) throw Exception("Cannot insert different element into constant column " + getName(), @@ -59,12 +59,12 @@ public: ++s; } - void insertData(const char * pos, size_t length) + void insertData(const char * pos, size_t length) override { throw Exception("Cannot insert element into constant column " + getName(), ErrorCodes::NOT_IMPLEMENTED); } - void insertFrom(const IColumn & src, size_t n) + void insertFrom(const IColumn & src, size_t n) override { if (data != static_cast &>(src).data) throw Exception("Cannot insert different element into constant column " + getName(), @@ -72,9 +72,9 @@ public: ++s; } - void insertDefault() { ++s; } + void insertDefault() override { ++s; } - ColumnPtr filter(const Filter & filt) const + ColumnPtr filter(const Filter & filt) const override { if (s != filt.size()) throw Exception("Size of filter doesn't match size of column.", ErrorCodes::SIZES_OF_COLUMNS_DOESNT_MATCH); @@ -82,7 +82,7 @@ public: return new ColumnConst(countBytesInFilter(filt), data, data_type); } - ColumnPtr replicate(const Offsets_t & offsets) const + ColumnPtr replicate(const Offsets_t & offsets) const override { if (s != offsets.size()) throw Exception("Size of offsets doesn't match size of column.", ErrorCodes::SIZES_OF_COLUMNS_DOESNT_MATCH); @@ -91,9 +91,9 @@ public: return new ColumnConst(replicated_size, data, data_type); } - size_t byteSize() const { return sizeof(data) + sizeof(s); } + size_t byteSize() const override { return sizeof(data) + sizeof(s); } - ColumnPtr permute(const Permutation & perm, size_t limit) const + ColumnPtr permute(const Permutation & perm, size_t limit) const override { if (limit == 0) limit = s; @@ -106,7 +106,7 @@ public: return new ColumnConst(limit, data, data_type); } - int compareAt(size_t n, size_t m, const IColumn & rhs_, int nan_direction_hint) const + int compareAt(size_t n, size_t m, const IColumn & rhs_, int nan_direction_hint) const override { const ColumnConst & rhs = static_cast &>(rhs_); return data < rhs.data /// TODO: правильное сравнение NaN-ов в константных столбцах. @@ -116,25 +116,25 @@ public: : 1); } - void getPermutation(bool reverse, size_t limit, Permutation & res) const + void getPermutation(bool reverse, size_t limit, Permutation & res) const override { res.resize(s); for (size_t i = 0; i < s; ++i) res[i] = i; } - StringRef getDataAt(size_t n) const; - StringRef getDataAtWithTerminatingZero(size_t n) const; - UInt64 get64(size_t n) const; + StringRef getDataAt(size_t n) const override; + StringRef getDataAtWithTerminatingZero(size_t n) const override; + UInt64 get64(size_t n) const override; /** Более эффективные методы манипуляции */ T & getData() { return data; } const T & getData() const { return data; } /** Преобразование из константы в полноценный столбец */ - ColumnPtr convertToFullColumn() const; + ColumnPtr convertToFullColumn() const override; - void getExtremes(Field & min, Field & max) const + void getExtremes(Field & min, Field & max) const override { min = FieldType(data); max = FieldType(data); diff --git a/dbms/include/DB/Columns/ColumnExpression.h b/dbms/include/DB/Columns/ColumnExpression.h index 535a3af37a7..712229b094a 100644 --- a/dbms/include/DB/Columns/ColumnExpression.h +++ b/dbms/include/DB/Columns/ColumnExpression.h @@ -6,7 +6,7 @@ namespace DB { - + /** Столбец, содержащий лямбда-выражение. * Ведёт себя как столбец-константа. Содержит выражение, но не входные или выходные данные. */ @@ -15,19 +15,19 @@ class ColumnExpression final : public IColumnDummy public: ColumnExpression(size_t s_, ExpressionActionsPtr expression_, const NamesAndTypes & arguments_, DataTypePtr return_type_, std::string return_name_) : IColumnDummy(s_), expression(expression_), arguments(arguments_), return_type(return_type_), return_name(return_name_) {} - + ColumnExpression(size_t s_, ExpressionActionsPtr expression_, const NamesAndTypesList & arguments_, DataTypePtr return_type_, std::string return_name_) : IColumnDummy(s_), expression(expression_), arguments(arguments_.begin(), arguments_.end()), return_type(return_type_), return_name(return_name_) {} - - std::string getName() const { return "ColumnExpression"; } - ColumnPtr cloneDummy(size_t s_) const { return new ColumnExpression(s_, expression, arguments, return_type, return_name); } - + + std::string getName() const override { return "ColumnExpression"; } + ColumnPtr cloneDummy(size_t s_) const override { return new ColumnExpression(s_, expression, arguments, return_type, return_name); } + const ExpressionActionsPtr & getExpression() const { return expression; } const DataTypePtr & getReturnType() const { return return_type; } const std::string & getReturnName() const { return return_name; } - + const NamesAndTypes & getArguments() const { return arguments; } - + Names getArgumentNames() const { Names res(arguments.size()); @@ -35,12 +35,12 @@ public: res[i] = arguments[i].name; return res; } - + private: ExpressionActionsPtr expression; NamesAndTypes arguments; DataTypePtr return_type; std::string return_name; }; - + } diff --git a/dbms/include/DB/Columns/ColumnFixedString.h b/dbms/include/DB/Columns/ColumnFixedString.h index c18af6e21da..d362adee5ef 100644 --- a/dbms/include/DB/Columns/ColumnFixedString.h +++ b/dbms/include/DB/Columns/ColumnFixedString.h @@ -27,49 +27,49 @@ public: /** Создать пустой столбец строк фиксированной длины n */ ColumnFixedString(size_t n_) : n(n_) {} - std::string getName() const { return "ColumnFixedString"; } + std::string getName() const override { return "ColumnFixedString"; } - ColumnPtr cloneEmpty() const + ColumnPtr cloneEmpty() const override { return new ColumnFixedString(n); } - size_t size() const + size_t size() const override { return chars.size() / n; } - size_t sizeOfField() const + size_t sizeOfField() const override { return n; } - bool isFixed() const + bool isFixed() const override { return true; } - size_t byteSize() const + size_t byteSize() const override { return chars.size() + sizeof(n); } - Field operator[](size_t index) const + Field operator[](size_t index) const override { return String(reinterpret_cast(&chars[n * index]), n); } - void get(size_t index, Field & res) const + void get(size_t index, Field & res) const override { res.assignString(reinterpret_cast(&chars[n * index]), n); } - StringRef getDataAt(size_t index) const + StringRef getDataAt(size_t index) const override { return StringRef(&chars[n * index], n); } - void insert(const Field & x) + void insert(const Field & x) override { const String & s = DB::get(x); @@ -81,7 +81,7 @@ public: memcpy(&chars[old_size], s.data(), s.size()); } - void insertFrom(const IColumn & src_, size_t index) + void insertFrom(const IColumn & src_, size_t index) override { const ColumnFixedString & src = static_cast(src_); @@ -93,7 +93,7 @@ public: memcpy(&chars[old_size], &src.chars[n * index], n); } - void insertData(const char * pos, size_t length) + void insertData(const char * pos, size_t length) override { if (length > n) throw Exception("Too large string for FixedString column", ErrorCodes::TOO_LARGE_STRING_SIZE); @@ -103,12 +103,12 @@ public: memcpy(&chars[old_size], pos, length); } - void insertDefault() + void insertDefault() override { chars.resize_fill(chars.size() + n); } - int compareAt(size_t p1, size_t p2, const IColumn & rhs_, int nan_direction_hint) const + int compareAt(size_t p1, size_t p2, const IColumn & rhs_, int nan_direction_hint) const override { const ColumnFixedString & rhs = static_cast(rhs_); return memcmp(&chars[p1 * n], &rhs.chars[p2 * n], n); @@ -127,7 +127,7 @@ public: } }; - void getPermutation(bool reverse, size_t limit, Permutation & res) const + void getPermutation(bool reverse, size_t limit, Permutation & res) const override { size_t s = size(); res.resize(s); @@ -153,7 +153,7 @@ public: } } - ColumnPtr cut(size_t start, size_t length) const + ColumnPtr cut(size_t start, size_t length) const override { ColumnFixedString * res_ = new ColumnFixedString(n); ColumnPtr res = res_; @@ -162,7 +162,7 @@ public: return res; } - ColumnPtr filter(const IColumn::Filter & filt) const + ColumnPtr filter(const IColumn::Filter & filt) const override { size_t col_size = size(); if (col_size != filt.size()) @@ -185,7 +185,7 @@ public: return res; } - ColumnPtr permute(const Permutation & perm, size_t limit) const + ColumnPtr permute(const Permutation & perm, size_t limit) const override { size_t col_size = size(); @@ -214,7 +214,7 @@ public: return res; } - ColumnPtr replicate(const Offsets_t & offsets) const + ColumnPtr replicate(const Offsets_t & offsets) const override { size_t col_size = size(); if (col_size != offsets.size()) @@ -243,7 +243,7 @@ public: return res; } - void getExtremes(Field & min, Field & max) const + void getExtremes(Field & min, Field & max) const override { min = String(); max = String(); diff --git a/dbms/include/DB/Columns/ColumnNested.h b/dbms/include/DB/Columns/ColumnNested.h index 4551150c4fe..401ac076f3f 100644 --- a/dbms/include/DB/Columns/ColumnNested.h +++ b/dbms/include/DB/Columns/ColumnNested.h @@ -47,7 +47,7 @@ public: } } - std::string getName() const + std::string getName() const override { std::string res; { @@ -63,7 +63,7 @@ public: return "ColumnNested(" + res + ")"; } - ColumnPtr cloneEmpty() const + ColumnPtr cloneEmpty() const override { Columns res(data.size()); for (size_t i = 0; i < data.size(); ++i) @@ -71,32 +71,32 @@ public: return new ColumnNested(res); } - size_t size() const + size_t size() const override { return getOffsets().size(); } - Field operator[](size_t n) const + Field operator[](size_t n) const override { throw Exception("Method operator[] is not supported for " + getName(), ErrorCodes::NOT_IMPLEMENTED); } - void get(size_t n, Field & res) const + void get(size_t n, Field & res) const override { throw Exception("Method get is not supported for " + getName(), ErrorCodes::NOT_IMPLEMENTED); } - StringRef getDataAt(size_t n) const + StringRef getDataAt(size_t n) const override { throw Exception("Method getDataAt is not supported for " + getName(), ErrorCodes::NOT_IMPLEMENTED); } - void insertData(const char * pos, size_t length) + void insertData(const char * pos, size_t length) override { throw Exception("Method insertData is not supported for " + getName(), ErrorCodes::NOT_IMPLEMENTED); } - ColumnPtr cut(size_t start, size_t length) const + ColumnPtr cut(size_t start, size_t length) const override { if (length == 0) return new ColumnNested(data); @@ -131,12 +131,12 @@ public: return res; } - void insert(const Field & x) + void insert(const Field & x) override { throw Exception("Method insert is not supported for " + getName(), ErrorCodes::NOT_IMPLEMENTED); } - void insertFrom(const IColumn & src_, size_t n) + void insertFrom(const IColumn & src_, size_t n) override { const ColumnNested & src = static_cast(src_); @@ -158,14 +158,14 @@ public: getOffsets().push_back((getOffsets().size() == 0 ? 0 : getOffsets().back()) + size); } - void insertDefault() + void insertDefault() override { for (size_t i = 0; i < data.size(); ++i) data[i]->insertDefault(); getOffsets().push_back(getOffsets().size() == 0 ? 1 : (getOffsets().back() + 1)); } - ColumnPtr filter(const Filter & filt) const + ColumnPtr filter(const Filter & filt) const override { size_t size = getOffsets().size(); if (size != filt.size()) @@ -205,12 +205,12 @@ public: return res; } - ColumnPtr replicate(const Offsets_t & offsets) const + ColumnPtr replicate(const Offsets_t & offsets) const override { throw Exception("Replication of ColumnNested is not implemented.", ErrorCodes::NOT_IMPLEMENTED); } - ColumnPtr permute(const Permutation & perm, size_t limit) const + ColumnPtr permute(const Permutation & perm, size_t limit) const override { size_t size = getOffsets().size(); if (size != perm.size()) @@ -255,24 +255,24 @@ public: return res; } - int compareAt(size_t n, size_t m, const IColumn & rhs_, int nan_direction_hint) const + int compareAt(size_t n, size_t m, const IColumn & rhs_, int nan_direction_hint) const override { throw Exception("Method compareAt is not supported for ColumnNested.", ErrorCodes::NOT_IMPLEMENTED); } - void getPermutation(bool reverse, size_t limit, Permutation & res) const + void getPermutation(bool reverse, size_t limit, Permutation & res) const override { throw Exception("Method getPermutation is not supported for ColumnNested.", ErrorCodes::NOT_IMPLEMENTED); } - void reserve(size_t n) + void reserve(size_t n) override { getOffsets().reserve(n); for (Columns::iterator it = data.begin(); it != data.end(); ++it) (*it)->reserve(n); } - size_t byteSize() const + size_t byteSize() const override { size_t size = getOffsets().size() * sizeof(getOffsets()[0]); for (Columns::const_iterator it = data.begin(); it != data.end(); ++it) @@ -280,7 +280,7 @@ public: return size; } - void getExtremes(Field & min, Field & max) const + void getExtremes(Field & min, Field & max) const override { throw Exception("Method getExtremes is not supported for " + getName(), ErrorCodes::NOT_IMPLEMENTED); } @@ -289,9 +289,6 @@ public: Columns & getData() { return data; } const Columns & getData() const { return data; } -// ColumnPtr & getDataPtr() { return data; } -// const ColumnPtr & getDataPtr() const { return data; } - Offsets_t & ALWAYS_INLINE getOffsets() { return static_cast(*offsets.get()).getData(); diff --git a/dbms/include/DB/Columns/ColumnReplicated.h b/dbms/include/DB/Columns/ColumnReplicated.h index 6fb9fc5f2c4..32abf953c67 100644 --- a/dbms/include/DB/Columns/ColumnReplicated.h +++ b/dbms/include/DB/Columns/ColumnReplicated.h @@ -5,7 +5,7 @@ namespace DB { - + /** Содержит промежуточные данные для вычисления выражений в функциях высшего порядка. * Это - вложенный столбец произвольного размера. * Сам ColumnReplicated притворяется, как столбец указанного в конструкторе размера. @@ -14,8 +14,8 @@ class ColumnReplicated final : public IColumnDummy { public: ColumnReplicated(size_t s_, ColumnPtr nested_) : IColumnDummy(s_), nested(nested_) {} - std::string getName() const { return "ColumnReplicated"; } - ColumnPtr cloneDummy(size_t s_) const { return new ColumnReplicated(s_, nested); } + std::string getName() const override { return "ColumnReplicated"; } + ColumnPtr cloneDummy(size_t s_) const override { return new ColumnReplicated(s_, nested); } ColumnPtr & getData() { return nested; } private: diff --git a/dbms/include/DB/Columns/ColumnSet.h b/dbms/include/DB/Columns/ColumnSet.h index 30b31eabe35..22b701815fb 100644 --- a/dbms/include/DB/Columns/ColumnSet.h +++ b/dbms/include/DB/Columns/ColumnSet.h @@ -17,11 +17,11 @@ public: ColumnSet(size_t s_, SetPtr data_) : IColumnDummy(s_), data(data_) {} /// Столбец не константный. Иначе столбец будет использоваться в вычислениях в ExpressionActions::prepare, когда множество из подзапроса ещё не готово. - bool isConst() const { return false; } + bool isConst() const override { return false; } + + std::string getName() const override { return "ColumnSet"; } + ColumnPtr cloneDummy(size_t s_) const override { return new ColumnSet(s_, data); } - std::string getName() const { return "ColumnSet"; } - ColumnPtr cloneDummy(size_t s_) const { return new ColumnSet(s_, data); } - SetPtr & getData() { return data; } const SetPtr & getData() const { return data; } diff --git a/dbms/include/DB/Columns/ColumnString.h b/dbms/include/DB/Columns/ColumnString.h index 990df17baf9..d5ff0e05a78 100644 --- a/dbms/include/DB/Columns/ColumnString.h +++ b/dbms/include/DB/Columns/ColumnString.h @@ -36,44 +36,44 @@ public: /** Создать пустой столбец строк */ ColumnString() {} - std::string getName() const { return "ColumnString"; } + std::string getName() const override { return "ColumnString"; } - size_t size() const + size_t size() const override { return offsets.size(); } - size_t byteSize() const + size_t byteSize() const override { return chars.size() + offsets.size() * sizeof(offsets[0]); } - ColumnPtr cloneEmpty() const + ColumnPtr cloneEmpty() const override { return new ColumnString; } - Field operator[](size_t n) const + Field operator[](size_t n) const override { return Field(&chars[offsetAt(n)], sizeAt(n) - 1); } - void get(size_t n, Field & res) const + void get(size_t n, Field & res) const override { res.assignString(&chars[offsetAt(n)], sizeAt(n) - 1); } - StringRef getDataAt(size_t n) const + StringRef getDataAt(size_t n) const override { return StringRef(&chars[offsetAt(n)], sizeAt(n) - 1); } - StringRef getDataAtWithTerminatingZero(size_t n) const + StringRef getDataAtWithTerminatingZero(size_t n) const override { return StringRef(&chars[offsetAt(n)], sizeAt(n)); } - void insert(const Field & x) + void insert(const Field & x) override { const String & s = DB::get(x); size_t old_size = chars.size(); @@ -84,7 +84,7 @@ public: offsets.push_back((offsets.size() == 0 ? 0 : offsets.back()) + size_to_append); } - void insertFrom(const IColumn & src_, size_t n) + void insertFrom(const IColumn & src_, size_t n) override { const ColumnString & src = static_cast(src_); size_t old_size = chars.size(); @@ -96,7 +96,7 @@ public: offsets.push_back((offsets.size() == 0 ? 0 : offsets.back()) + size_to_append); } - void insertData(const char * pos, size_t length) + void insertData(const char * pos, size_t length) override { size_t old_size = chars.size(); @@ -106,7 +106,7 @@ public: offsets.push_back((offsets.size() == 0 ? 0 : offsets.back()) + length + 1); } - void insertDataWithTerminatingZero(const char * pos, size_t length) + void insertDataWithTerminatingZero(const char * pos, size_t length) override { size_t old_size = chars.size(); @@ -115,7 +115,7 @@ public: offsets.push_back((offsets.size() == 0 ? 0 : offsets.back()) + length); } - ColumnPtr cut(size_t start, size_t length) const + ColumnPtr cut(size_t start, size_t length) const override { if (length == 0) return new ColumnString; @@ -150,7 +150,7 @@ public: return res; } - ColumnPtr filter(const Filter & filt) const + ColumnPtr filter(const Filter & filt) const override { const size_t size = offsets.size(); if (size != filt.size()) @@ -257,7 +257,7 @@ public: return res_; } - ColumnPtr permute(const Permutation & perm, size_t limit) const + ColumnPtr permute(const Permutation & perm, size_t limit) const override { size_t size = offsets.size(); @@ -300,13 +300,13 @@ public: return res; } - void insertDefault() + void insertDefault() override { chars.push_back(0); offsets.push_back(offsets.size() == 0 ? 1 : (offsets.back() + 1)); } - int compareAt(size_t n, size_t m, const IColumn & rhs_, int nan_direction_hint) const + int compareAt(size_t n, size_t m, const IColumn & rhs_, int nan_direction_hint) const override { const ColumnString & rhs = static_cast(rhs_); @@ -344,7 +344,7 @@ public: } }; - void getPermutation(bool reverse, size_t limit, Permutation & res) const + void getPermutation(bool reverse, size_t limit, Permutation & res) const override { size_t s = offsets.size(); res.resize(s); @@ -415,7 +415,7 @@ public: } } - ColumnPtr replicate(const Offsets_t & replicate_offsets) const + ColumnPtr replicate(const Offsets_t & replicate_offsets) const override { size_t col_size = size(); if (col_size != replicate_offsets.size()) @@ -457,13 +457,13 @@ public: return res; } - void reserve(size_t n) + void reserve(size_t n) override { offsets.reserve(n); chars.reserve(n * DBMS_APPROX_STRING_SIZE); } - void getExtremes(Field & min, Field & max) const + void getExtremes(Field & min, Field & max) const override { min = String(); max = String(); diff --git a/dbms/include/DB/Columns/ColumnTuple.h b/dbms/include/DB/Columns/ColumnTuple.h index 911fd7b695d..4a85f036180 100644 --- a/dbms/include/DB/Columns/ColumnTuple.h +++ b/dbms/include/DB/Columns/ColumnTuple.h @@ -25,22 +25,20 @@ public: for (size_t i = 0; i < size; ++i) columns[i] = data.getByPosition(i).column; } - - std::string getName() const { return "Tuple"; } - - SharedPtr cloneEmpty() const + + std::string getName() const override { return "Tuple"; } + + SharedPtr cloneEmpty() const override { return new ColumnTuple(data.cloneEmpty()); } - size_t size() const + size_t size() const override { return data.rows(); } - bool empty() const { return size() == 0; } - - Field operator[](size_t n) const + Field operator[](size_t n) const override { Array res; @@ -50,7 +48,7 @@ public: return res; } - void get(size_t n, Field & res) const + void get(size_t n, Field & res) const override { size_t size = columns.size(); res = Array(size); @@ -59,17 +57,17 @@ public: columns[i]->get(n, res_arr[i]); } - StringRef getDataAt(size_t n) const + StringRef getDataAt(size_t n) const override { throw Exception("Method getDataAt is not supported for " + getName(), ErrorCodes::NOT_IMPLEMENTED); } - void insertData(const char * pos, size_t length) + void insertData(const char * pos, size_t length) override { throw Exception("Method insertData is not supported for " + getName(), ErrorCodes::NOT_IMPLEMENTED); } - void insert(const Field & x) + void insert(const Field & x) override { const Array & arr = DB::get(x); @@ -81,36 +79,36 @@ public: columns[i]->insert(arr[i]); } - void insertFrom(const IColumn & src_, size_t n) + void insertFrom(const IColumn & src_, size_t n) override { const ColumnTuple & src = static_cast(src_); - + size_t size = columns.size(); if (src.columns.size() != size) throw Exception("Cannot insert value of different size into tuple", ErrorCodes::CANNOT_INSERT_VALUE_OF_DIFFERENT_SIZE_INTO_TUPLE); - + for (size_t i = 0; i < size; ++i) columns[i]->insertFrom(*src.columns[i], n); } - void insertDefault() + void insertDefault() override { for (Columns::iterator it = columns.begin(); it != columns.end(); ++it) (*it)->insertDefault(); } - ColumnPtr cut(size_t start, size_t length) const + ColumnPtr cut(size_t start, size_t length) const override { Block res_block = data.cloneEmpty(); - + for (size_t i = 0; i < columns.size(); ++i) res_block.getByPosition(i).column = data.getByPosition(i).column->cut(start, length); return new ColumnTuple(res_block); } - ColumnPtr filter(const Filter & filt) const + ColumnPtr filter(const Filter & filt) const override { Block res_block = data.cloneEmpty(); @@ -120,7 +118,7 @@ public: return new ColumnTuple(res_block); } - ColumnPtr permute(const Permutation & perm, size_t limit) const + ColumnPtr permute(const Permutation & perm, size_t limit) const override { Block res_block = data.cloneEmpty(); @@ -129,8 +127,8 @@ public: return new ColumnTuple(res_block); } - - ColumnPtr replicate(const Offsets_t & offsets) const + + ColumnPtr replicate(const Offsets_t & offsets) const override { Block res_block = data.cloneEmpty(); @@ -140,13 +138,13 @@ public: return new ColumnTuple(res_block); } - int compareAt(size_t n, size_t m, const IColumn & rhs, int nan_direction_hint) const + int compareAt(size_t n, size_t m, const IColumn & rhs, int nan_direction_hint) const override { size_t size = columns.size(); for (size_t i = 0; i < size; ++i) if (int res = columns[i]->compareAt(n, m, *static_cast(rhs).columns[i], nan_direction_hint)) return res; - + return 0; } @@ -175,7 +173,7 @@ public: } }; - void getPermutation(bool reverse, size_t limit, Permutation & res) const + void getPermutation(bool reverse, size_t limit, Permutation & res) const override { size_t rows = size(); res.resize(rows); @@ -201,13 +199,13 @@ public: } } - void reserve(size_t n) + void reserve(size_t n) override { for (Columns::iterator it = columns.begin(); it != columns.end(); ++it) (*it)->reserve(n); } - size_t byteSize() const + size_t byteSize() const override { size_t res = 0; for (Columns::const_iterator it = columns.begin(); it != columns.end(); ++it) @@ -215,7 +213,7 @@ public: return res; } - void getExtremes(Field & min, Field & max) const + void getExtremes(Field & min, Field & max) const override { throw Exception("Method getExtremes is not supported for " + getName(), ErrorCodes::NOT_IMPLEMENTED); } diff --git a/dbms/include/DB/Columns/ColumnVector.h b/dbms/include/DB/Columns/ColumnVector.h index a3299d1da4e..bccc6ab831b 100644 --- a/dbms/include/DB/Columns/ColumnVector.h +++ b/dbms/include/DB/Columns/ColumnVector.h @@ -89,42 +89,42 @@ public: ColumnVector(const size_t n) : data{n} {} ColumnVector(const size_t n, const value_type x) : data{n, x} {} - bool isNumeric() const { return IsNumber::value; } - bool isFixed() const { return IsNumber::value; } + bool isNumeric() const override { return IsNumber::value; } + bool isFixed() const override { return IsNumber::value; } - size_t sizeOfField() const { return sizeof(T); } + size_t sizeOfField() const override { return sizeof(T); } - size_t size() const + size_t size() const override { return data.size(); } - StringRef getDataAt(size_t n) const + StringRef getDataAt(size_t n) const override { return StringRef(reinterpret_cast(&data[n]), sizeof(data[n])); } - void insertFrom(const IColumn & src, size_t n) + void insertFrom(const IColumn & src, size_t n) override { data.push_back(static_cast(src).getData()[n]); } - void insertData(const char * pos, size_t length) + void insertData(const char * pos, size_t length) override { data.push_back(*reinterpret_cast(pos)); } - void insertDefault() + void insertDefault() override { data.push_back(T()); } - size_t byteSize() const + size_t byteSize() const override { return data.size() * sizeof(data[0]); } - int compareAt(size_t n, size_t m, const IColumn & rhs_, int nan_direction_hint) const + int compareAt(size_t n, size_t m, const IColumn & rhs_, int nan_direction_hint) const override { return CompareHelper::compare(data[n], static_cast(rhs_).data[m], nan_direction_hint); } @@ -143,7 +143,7 @@ public: bool operator()(size_t lhs, size_t rhs) const { return CompareHelper::greater(parent.data[lhs], parent.data[rhs]); } }; - void getPermutation(bool reverse, size_t limit, Permutation & res) const + void getPermutation(bool reverse, size_t limit, Permutation & res) const override { size_t s = data.size(); res.resize(s); @@ -169,36 +169,36 @@ public: } } - void reserve(size_t n) + void reserve(size_t n) override { data.reserve(n); } - std::string getName() const { return "ColumnVector<" + TypeName::get() + ">"; } + std::string getName() const override { return "ColumnVector<" + TypeName::get() + ">"; } - ColumnPtr cloneEmpty() const + ColumnPtr cloneEmpty() const override { return new ColumnVector; } - Field operator[](size_t n) const + Field operator[](size_t n) const override { return typename NearestFieldType::Type(data[n]); } - void get(size_t n, Field & res) const + void get(size_t n, Field & res) const override { res = typename NearestFieldType::Type(data[n]); } - UInt64 get64(size_t n) const; + UInt64 get64(size_t n) const override; - void insert(const Field & x) + void insert(const Field & x) override { data.push_back(DB::get::Type>(x)); } - ColumnPtr cut(size_t start, size_t length) const + ColumnPtr cut(size_t start, size_t length) const override { if (start + length > data.size()) throw Exception("Parameters start = " @@ -212,7 +212,7 @@ public: return res; } - ColumnPtr filter(const IColumn::Filter & filt) const + ColumnPtr filter(const IColumn::Filter & filt) const override { size_t size = data.size(); if (size != filt.size()) @@ -270,7 +270,7 @@ public: return res; } - ColumnPtr permute(const IColumn::Permutation & perm, size_t limit) const + ColumnPtr permute(const IColumn::Permutation & perm, size_t limit) const override { size_t size = data.size(); @@ -291,7 +291,7 @@ public: return res; } - ColumnPtr replicate(const IColumn::Offsets_t & offsets) const + ColumnPtr replicate(const IColumn::Offsets_t & offsets) const override { size_t size = data.size(); if (size != offsets.size()) @@ -318,7 +318,7 @@ public: return res; } - void getExtremes(Field & min, Field & max) const + void getExtremes(Field & min, Field & max) const override { size_t size = data.size(); diff --git a/dbms/include/DB/Columns/IColumnDummy.h b/dbms/include/DB/Columns/IColumnDummy.h index 1ab49024fc8..ab12d3e11d0 100644 --- a/dbms/include/DB/Columns/IColumnDummy.h +++ b/dbms/include/DB/Columns/IColumnDummy.h @@ -17,30 +17,30 @@ public: virtual ColumnPtr cloneDummy(size_t s_) const = 0; - ColumnPtr cloneResized(size_t s_) const { return cloneDummy(s_); } - bool isConst() const { return true; } - size_t size() const { return s; } - void insertDefault() { ++s; } - size_t byteSize() const { return 0; } - int compareAt(size_t n, size_t m, const IColumn & rhs_, int nan_direction_hint) const { return 0; } + ColumnPtr cloneResized(size_t s_) const override { return cloneDummy(s_); } + bool isConst() const override { return true; } + size_t size() const override { return s; } + void insertDefault() override { ++s; } + size_t byteSize() const override { return 0; } + int compareAt(size_t n, size_t m, const IColumn & rhs_, int nan_direction_hint) const override { return 0; } - Field operator[](size_t n) const { throw Exception("Cannot get value from " + getName(), ErrorCodes::NOT_IMPLEMENTED); } - void get(size_t n, Field & res) const { throw Exception("Cannot get value from " + getName(), ErrorCodes::NOT_IMPLEMENTED); }; - void insert(const Field & x) { throw Exception("Cannot insert element into " + getName(), ErrorCodes::NOT_IMPLEMENTED); } - StringRef getDataAt(size_t n) const { throw Exception("Method getDataAt is not supported for " + getName(), ErrorCodes::NOT_IMPLEMENTED); } - void insertData(const char * pos, size_t length) { throw Exception("Method insertData is not supported for " + getName(), ErrorCodes::NOT_IMPLEMENTED); } + Field operator[](size_t n) const override { throw Exception("Cannot get value from " + getName(), ErrorCodes::NOT_IMPLEMENTED); } + void get(size_t n, Field & res) const override { throw Exception("Cannot get value from " + getName(), ErrorCodes::NOT_IMPLEMENTED); }; + void insert(const Field & x) override { throw Exception("Cannot insert element into " + getName(), ErrorCodes::NOT_IMPLEMENTED); } + StringRef getDataAt(size_t n) const override { throw Exception("Method getDataAt is not supported for " + getName(), ErrorCodes::NOT_IMPLEMENTED); } + void insertData(const char * pos, size_t length) override { throw Exception("Method insertData is not supported for " + getName(), ErrorCodes::NOT_IMPLEMENTED); } - void getExtremes(Field & min, Field & max) const + void getExtremes(Field & min, Field & max) const override { throw Exception("Method getExtremes is not supported for " + getName(), ErrorCodes::NOT_IMPLEMENTED); } - ColumnPtr cut(size_t start, size_t length) const + ColumnPtr cut(size_t start, size_t length) const override { return cloneDummy(length); } - ColumnPtr filter(const Filter & filt) const + ColumnPtr filter(const Filter & filt) const override { size_t new_size = 0; for (Filter::const_iterator it = filt.begin(); it != filt.end(); ++it) @@ -50,7 +50,7 @@ public: return cloneDummy(new_size); } - ColumnPtr permute(const Permutation & perm, size_t limit) const + ColumnPtr permute(const Permutation & perm, size_t limit) const override { if (s != perm.size()) throw Exception("Size of permutation doesn't match size of column.", ErrorCodes::SIZES_OF_COLUMNS_DOESNT_MATCH); @@ -58,14 +58,14 @@ public: return cloneDummy(limit ? std::min(s, limit) : s); } - void getPermutation(bool reverse, size_t limit, Permutation & res) const + void getPermutation(bool reverse, size_t limit, Permutation & res) const override { res.resize(s); for (size_t i = 0; i < s; ++i) res[i] = i; } - ColumnPtr replicate(const Offsets_t & offsets) const + ColumnPtr replicate(const Offsets_t & offsets) const override { if (s != offsets.size()) throw Exception("Size of offsets doesn't match size of column.", ErrorCodes::SIZES_OF_COLUMNS_DOESNT_MATCH);