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;
|
|
|
|
|
|
|
|
|
|
|
|
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); }
|
|
|
|
|
|
|
|
/** Get a list of names and table column types, only non-virtual.
|
|
|
|
*/
|
|
|
|
NamesAndTypesList getList() const;
|
|
|
|
const NamesAndTypesList & getListNonMaterialized() const { return ordinary; }
|
|
|
|
|
|
|
|
/** Get a list of column names.
|
|
|
|
*/
|
|
|
|
Names getNames() const;
|
|
|
|
|
|
|
|
/** Get a description of any column by its name.
|
|
|
|
*/
|
|
|
|
NameAndTypePair get(const String & column_name) const;
|
|
|
|
|
|
|
|
/** Is there a column with that name.
|
|
|
|
*/
|
|
|
|
bool has(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
|
|
|
};
|
|
|
|
|
|
|
|
}
|