mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-10-18 22:40:50 +00:00
97f2a2213e
* Move some code outside dbms/src folder * Fix paths
54 lines
1.1 KiB
C++
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();
|
|
}
|
|
|
|
}
|