2015-04-11 03:10:23 +00:00
|
|
|
#pragma once
|
|
|
|
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <Core/NamesAndTypes.h>
|
2018-03-06 20:18:34 +00:00
|
|
|
#include <Core/Names.h>
|
|
|
|
#include <Storages/ColumnDefault.h>
|
|
|
|
#include <Core/Block.h>
|
2015-04-11 03:10:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
struct ColumnsDescription
|
|
|
|
{
|
2018-03-06 20:18:34 +00:00
|
|
|
NamesAndTypesList ordinary;
|
|
|
|
NamesAndTypesList materialized;
|
|
|
|
NamesAndTypesList aliases;
|
|
|
|
ColumnDefaults defaults;
|
|
|
|
|
2018-03-10 17:03:57 +00:00
|
|
|
ColumnsDescription() = default;
|
|
|
|
|
|
|
|
ColumnsDescription(
|
|
|
|
NamesAndTypesList ordinary_,
|
|
|
|
NamesAndTypesList materialized_,
|
|
|
|
NamesAndTypesList aliases_,
|
|
|
|
ColumnDefaults defaults_)
|
|
|
|
: ordinary(std::move(ordinary_))
|
|
|
|
, materialized(std::move(materialized_))
|
|
|
|
, aliases(std::move(aliases_))
|
|
|
|
, defaults(std::move(defaults_))
|
|
|
|
{}
|
|
|
|
|
|
|
|
explicit ColumnsDescription(NamesAndTypesList ordinary_) : ordinary(std::move(ordinary_)) {}
|
2018-03-06 20:18:34 +00:00
|
|
|
|
|
|
|
bool operator==(const ColumnsDescription & other) const
|
|
|
|
{
|
|
|
|
return ordinary == other.ordinary
|
|
|
|
&& materialized == other.materialized
|
|
|
|
&& aliases == other.aliases
|
|
|
|
&& defaults == other.defaults;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator!=(const ColumnsDescription & other) const { return !(*this == other); }
|
|
|
|
|
2018-03-10 17:03:57 +00:00
|
|
|
/// ordinary + materialized.
|
2018-03-13 15:00:28 +00:00
|
|
|
NamesAndTypesList getAllPhysical() const;
|
2018-03-10 17:03:57 +00:00
|
|
|
|
|
|
|
/// ordinary + materialized + aliases.
|
|
|
|
NamesAndTypesList getAll() const;
|
2018-03-06 20:18:34 +00:00
|
|
|
|
2018-03-13 15:00:28 +00:00
|
|
|
Names getNamesOfPhysical() const;
|
2018-03-06 20:18:34 +00:00
|
|
|
|
2018-03-13 15:00:28 +00:00
|
|
|
NameAndTypePair getPhysical(const String & column_name) const;
|
2018-03-06 20:18:34 +00:00
|
|
|
|
2018-03-13 15:00:28 +00:00
|
|
|
bool hasPhysical(const String & column_name) const;
|
2015-04-11 03:10:23 +00:00
|
|
|
|
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
String toString() const;
|
2015-04-11 03:10:23 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
static ColumnsDescription parse(const String & str);
|
2015-04-11 03:10:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|