#include #include #include #include #include #include namespace DB { String IColumn::dumpStructure() const { WriteBufferFromOwnString res; res << getFamilyName() << "(size = " << size(); ColumnCallback callback = [&](ColumnPtr & subcolumn) { res << ", " << subcolumn->dumpStructure(); }; const_cast(this)->forEachSubcolumn(callback); res << ")"; return res.str(); } void IColumn::insertFrom(const IColumn & src, size_t n) { insert(src[n]); } void IColumn::getIndicesOfNonDefaultValues(Offsets & indices, size_t from, size_t limit) const { size_t to = limit && from + limit < size() ? from + limit : size(); indices.reserve(indices.size() + to - from); for (size_t i = from; i < to; ++i) indices.push_back(i); } ColumnPtr IColumn::createWithOffsets(const Offsets & offsets, size_t total_rows) const { auto res = cloneEmpty(); res->reserve(total_rows); ssize_t current_offset = -1; for (size_t i = 0; i < offsets.size(); ++i) { ssize_t offsets_diff = static_cast(offsets[i]) - current_offset; current_offset = offsets[i]; if (offsets_diff > 1) res->insertManyFrom(*this, 0, offsets_diff - 1); res->insertFrom(*this, i + 1); } ssize_t offsets_diff = static_cast(total_rows) - current_offset; if(offsets_diff > 1) res->insertManyFrom(*this, 0, offsets_diff - 1); return res; } bool isColumnNullable(const IColumn & column) { return checkColumn(column); } bool isColumnConst(const IColumn & column) { return checkColumn(column); } }