ClickHouse/dbms/src/Columns/IColumn.cpp
2019-09-30 15:31:14 +03:00

44 lines
830 B
C++

#include <IO/WriteBufferFromString.h>
#include <IO/Operators.h>
#include <Columns/IColumn.h>
#include <Columns/ColumnNullable.h>
#include <Columns/ColumnConst.h>
#include <Core/Field.h>
namespace DB
{
String IColumn::dumpStructure() const
{
WriteBufferFromOwnString res;
res << getFamilyName() << "(size = " << size();
ColumnCallback callback = [&](ColumnPtr & subcolumn)
{
res << ", " << subcolumn->dumpStructure();
};
const_cast<IColumn*>(this)->forEachSubcolumn(callback);
res << ")";
return res.str();
}
void IColumn::insertFrom(const IColumn & src, size_t n)
{
insert(src[n]);
}
bool isColumnNullable(const IColumn & column)
{
return checkColumn<ColumnNullable>(column);
}
bool isColumnConst(const IColumn & column)
{
return checkColumn<ColumnConst>(column);
}
}