1#pragma once
2
3#include <Columns/IColumn.h>
4#include <DataTypes/IDataType.h>
5
6
7namespace DB
8{
9
10class WriteBuffer;
11
12
13/** Column data along with its data type and name.
14 * Column data could be nullptr - to represent just 'header' of column.
15 * Name could be either name from a table or some temporary generated name during expression evaluation.
16 */
17#pragma GCC diagnostic push
18#pragma GCC diagnostic ignored "-Wnull-dereference"
19struct ColumnWithTypeAndName
20{
21 ColumnPtr column;
22 DataTypePtr type;
23 String name;
24
25 ColumnWithTypeAndName() {}
26 ColumnWithTypeAndName(const ColumnPtr & column_, const DataTypePtr & type_, const String & name_)
27 : column(column_), type(type_), name(name_) {}
28
29 /// Uses type->createColumn() to create column
30 ColumnWithTypeAndName(const DataTypePtr & type_, const String & name_)
31 : column(type_->createColumn()), type(type_), name(name_) {}
32
33 ColumnWithTypeAndName cloneEmpty() const;
34 bool operator==(const ColumnWithTypeAndName & other) const;
35
36 void dumpStructure(WriteBuffer & out) const;
37 String dumpStructure() const;
38};
39#pragma GCC diagnostic pop
40
41}
42