ClickHouse/dbms/Core/ColumnWithTypeAndName.cpp
Ivan 97f2a2213e
Move all folders inside /dbms one level up (#9974)
* Move some code outside dbms/src folder
* Fix paths
2020-04-02 02:51:21 +03:00

54 lines
1.1 KiB
C++

#include <Core/ColumnsWithTypeAndName.h>
#include <IO/WriteBufferFromString.h>
#include <IO/WriteHelpers.h>
#include <IO/Operators.h>
namespace DB
{
ColumnWithTypeAndName ColumnWithTypeAndName::cloneEmpty() const
{
ColumnWithTypeAndName res;
res.name = name;
res.type = type;
if (column)
res.column = column->cloneEmpty();
return res;
}
bool ColumnWithTypeAndName::operator==(const ColumnWithTypeAndName & other) const
{
return name == other.name
&& ((!type && !other.type) || (type && other.type && type->equals(*other.type)))
&& ((!column && !other.column) || (column && other.column && column->getName() == other.column->getName()));
}
void ColumnWithTypeAndName::dumpStructure(WriteBuffer & out) const
{
out << name;
if (type)
out << ' ' << type->getName();
else
out << " nullptr";
if (column)
out << ' ' << column->dumpStructure();
else
out << " nullptr";
}
String ColumnWithTypeAndName::dumpStructure() const
{
WriteBufferFromOwnString out;
dumpStructure(out);
return out.str();
}
}