dbms: renamed ColumnWithNameAndType to ColumnWithTypeAndName for clarification [#METR-2944].

This commit is contained in:
Alexey Milovidov 2015-07-17 04:27:35 +03:00
parent 71f64f2d49
commit c0e029bb1b
84 changed files with 321 additions and 321 deletions

View File

@ -47,7 +47,7 @@ public:
for (size_t i = 0; i < structure.size(); ++i)
{
ColumnWithNameAndType column;
ColumnWithTypeAndName column;
column.name = structure[i].first;
column.type = data_type_factory.get(structure[i].second);
column.column = column.type->createColumn();

View File

@ -37,7 +37,7 @@ template<typename T1>
std::multiset<T1> extractSingleValueFromBlock(const Block & block, const String & name)
{
std::multiset<T1> res;
const ColumnWithNameAndType & data = block.getByName(name);
const ColumnWithTypeAndName & data = block.getByName(name);
size_t rows = block.rows();
for (size_t i = 0; i < rows; ++i)
res.insert((*data.column)[i].get<T1>());

View File

@ -6,11 +6,11 @@
#include <initializer_list>
#include <DB/Core/BlockInfo.h>
#include <DB/Core/ColumnWithNameAndType.h>
#include <DB/Core/ColumnWithTypeAndName.h>
#include <DB/Core/NamesAndTypes.h>
#include <DB/Core/Exception.h>
#include <DB/Core/ErrorCodes.h>
#include "ColumnsWithNameAndType.h"
#include "ColumnsWithTypeAndName.h"
namespace DB
@ -26,7 +26,7 @@ class Context;
class Block
{
public:
typedef std::list<ColumnWithNameAndType> Container_t;
typedef std::list<ColumnWithTypeAndName> Container_t;
typedef std::vector<Container_t::iterator> IndexByPosition_t;
typedef std::map<String, Container_t::iterator> IndexByName_t;
@ -39,7 +39,7 @@ public:
BlockInfo info;
Block() = default;
Block(std::initializer_list<ColumnWithNameAndType> il) : data{il}
Block(std::initializer_list<ColumnWithTypeAndName> il) : data{il}
{
index_by_position.reserve(il.size());
for (auto it = std::begin(data); it != std::end(data); ++it)
@ -56,11 +56,11 @@ public:
Block & operator= (Block && other) = default;
/// вставить столбец в заданную позицию
void insert(size_t position, const ColumnWithNameAndType & elem);
void insert(size_t position, const ColumnWithTypeAndName & elem);
/// вставить столбец в конец
void insert(const ColumnWithNameAndType & elem);
void insert(const ColumnWithTypeAndName & elem);
/// вставить столбец в конец, если столбца с таким именем ещё нет
void insertUnique(const ColumnWithNameAndType & elem);
void insertUnique(const ColumnWithTypeAndName & elem);
/// удалить столбец в заданной позиции
void erase(size_t position);
/// удалить столбец с заданным именем
@ -68,20 +68,20 @@ public:
/// Добавляет в блок недостающие столбцы со значениями по-умолчанию
void addDefaults(const NamesAndTypesList & required_columns);
ColumnWithNameAndType & getByPosition(size_t position);
const ColumnWithNameAndType & getByPosition(size_t position) const;
ColumnWithTypeAndName & getByPosition(size_t position);
const ColumnWithTypeAndName & getByPosition(size_t position) const;
ColumnWithNameAndType & unsafeGetByPosition(size_t position) { return *index_by_position[position]; }
const ColumnWithNameAndType & unsafeGetByPosition(size_t position) const { return *index_by_position[position]; }
ColumnWithTypeAndName & unsafeGetByPosition(size_t position) { return *index_by_position[position]; }
const ColumnWithTypeAndName & unsafeGetByPosition(size_t position) const { return *index_by_position[position]; }
ColumnWithNameAndType & getByName(const std::string & name);
const ColumnWithNameAndType & getByName(const std::string & name) const;
ColumnWithTypeAndName & getByName(const std::string & name);
const ColumnWithTypeAndName & getByName(const std::string & name) const;
bool has(const std::string & name) const;
size_t getPositionByName(const std::string & name) const;
ColumnsWithNameAndType getColumns() const;
ColumnsWithTypeAndName getColumns() const;
NamesAndTypesList getColumnsList() const;
/** Возвращает количество строк в блоке.

View File

@ -14,19 +14,19 @@ using Poco::SharedPtr;
/** Тип данных для представления столбца вместе с его типом и именем в оперативке.
*/
struct ColumnWithNameAndType
struct ColumnWithTypeAndName
{
ColumnPtr column;
DataTypePtr type;
String name;
ColumnWithNameAndType() {}
ColumnWithNameAndType(const ColumnPtr & column_, const DataTypePtr & type_, const String name_)
ColumnWithTypeAndName() {}
ColumnWithTypeAndName(const ColumnPtr & column_, const DataTypePtr & type_, const String name_)
: column(column_), type(type_), name(name_) {}
ColumnWithNameAndType cloneEmpty() const
ColumnWithTypeAndName cloneEmpty() const
{
ColumnWithNameAndType res;
ColumnWithTypeAndName res;
res.name = name;
res.type = type->clone();

View File

@ -1,13 +0,0 @@
#pragma once
#include <vector>
#include <DB/Core/ColumnWithNameAndType.h>
namespace DB
{
typedef std::vector<ColumnWithNameAndType> ColumnsWithNameAndType;
}

View File

@ -0,0 +1,13 @@
#pragma once
#include <vector>
#include <DB/Core/ColumnWithTypeAndName.h>
namespace DB
{
typedef std::vector<ColumnWithTypeAndName> ColumnsWithTypeAndName;
}

View File

@ -4,7 +4,7 @@
#include <DB/DataStreams/IProfilingBlockInputStream.h>
#include <DB/Columns/ColumnConst.h>
#include <DB/Core/ColumnWithNameAndType.h>
#include <DB/Core/ColumnWithTypeAndName.h>
namespace DB
{
@ -41,7 +41,7 @@ protected:
if (!res)
return res;
ColumnPtr column_ptr = ColumnConst<ColumnType>(res.rows(), value, data_type).convertToFullColumn();
ColumnWithNameAndType column(column_ptr, data_type, column_name);
ColumnWithTypeAndName column(column_ptr, data_type, column_name);
res.insert(column);
return res;
}

View File

@ -136,7 +136,7 @@ public:
Block tuple_block;
for (size_t i = 0, size = elems.size(); i < size; ++i)
{
ColumnWithNameAndType col;
ColumnWithTypeAndName col;
col.column = elems[i]->createColumn();
col.type = elems[i]->clone();
tuple_block.insert(col);

View File

@ -18,7 +18,7 @@ namespace
Block createSampleBlock(const DictionaryStructure & dict_struct)
{
Block block{
ColumnWithNameAndType{
ColumnWithTypeAndName{
new ColumnUInt64,
new DataTypeUInt64,
dict_struct.id_name
@ -26,7 +26,7 @@ Block createSampleBlock(const DictionaryStructure & dict_struct)
};
for (const auto & attribute : dict_struct.attributes)
block.insert(ColumnWithNameAndType{
block.insert(ColumnWithTypeAndName{
attribute.type->createColumn(), attribute.type, attribute.name
});

View File

@ -634,12 +634,12 @@ private:
for (size_t i = 0; i < tuple_size; ++i)
{
ColumnWithNameAndType array_of_tuple_section;
ColumnWithTypeAndName array_of_tuple_section;
array_of_tuple_section.column = new ColumnArray(tuple_block.getByPosition(i).column, col_array->getOffsetsColumn());
array_of_tuple_section.type = new DataTypeArray(tuple_block.getByPosition(i).type);
block_of_temporary_results.insert(array_of_tuple_section);
ColumnWithNameAndType array_elements_of_tuple_section;
ColumnWithTypeAndName array_elements_of_tuple_section;
block_of_temporary_results.insert(array_elements_of_tuple_section);
execute(block_of_temporary_results, ColumnNumbers{i * 2 + 1, 0}, i * 2 + 2);

View File

@ -1018,7 +1018,7 @@ public:
* Если функция неприменима для данных аргументов - кинуть исключение.
* Для неконстантных столбцов arguments[i].column = nullptr.
*/
void getReturnTypeAndPrerequisites(const ColumnsWithNameAndType & arguments,
void getReturnTypeAndPrerequisites(const ColumnsWithTypeAndName & arguments,
DataTypePtr & out_return_type,
std::vector<ExpressionAction> & out_prerequisites)
{
@ -1099,7 +1099,7 @@ public:
private:
template <typename T>
bool getSizeTyped(const ColumnWithNameAndType & column, size_t & out_size)
bool getSizeTyped(const ColumnWithTypeAndName & column, size_t & out_size)
{
if (!typeid_cast<const typename DataTypeFromFieldType<T>::Type *>(&*column.type))
return false;
@ -1113,7 +1113,7 @@ private:
return true;
}
size_t getSize(const ColumnWithNameAndType & column)
size_t getSize(const ColumnWithTypeAndName & column)
{
size_t res;
if (getSizeTyped<UInt8>(column, res) ||

View File

@ -592,7 +592,7 @@ public:
for (size_t i = 0; i < arguments.size(); ++i)
{
const ColumnWithNameAndType & column = block.getByPosition(arguments[i]);
const ColumnWithTypeAndName & column = block.getByPosition(arguments[i]);
const IDataType * from_type = &*column.type;
const IColumn * icolumn = &*column.column;

View File

@ -586,7 +586,7 @@ public:
arguments[0] = new DataTypeExpression(nested_types);
}
void getReturnTypeAndPrerequisites(const ColumnsWithNameAndType & arguments,
void getReturnTypeAndPrerequisites(const ColumnsWithTypeAndName & arguments,
DataTypePtr & out_return_type,
ExpressionActions::Actions & out_prerequisites)
{
@ -725,7 +725,7 @@ public:
column_first_array = column_array;
}
temp_block.insert(ColumnWithNameAndType(
temp_block.insert(ColumnWithTypeAndName(
column_array->getDataPtr(),
argument_type,
argument_name));
@ -745,7 +745,7 @@ public:
if (argument_names.count(name))
continue;
ColumnWithNameAndType replicated_column = block.getByPosition(prerequisites[prerequisite_index]);
ColumnWithTypeAndName replicated_column = block.getByPosition(prerequisites[prerequisite_index]);
replicated_column.name = name;
replicated_column.column = typeid_cast<ColumnArray &>(*replicated_column.column).getDataPtr();

View File

@ -453,7 +453,7 @@ public:
return name;
}
void getReturnTypeAndPrerequisites(const ColumnsWithNameAndType & arguments,
void getReturnTypeAndPrerequisites(const ColumnsWithTypeAndName & arguments,
DataTypePtr & out_return_type,
ExpressionActions::Actions & out_prerequisites)
{

View File

@ -5,7 +5,7 @@
#include <DB/Core/Names.h>
#include <DB/Core/Block.h>
#include <DB/Core/ColumnNumbers.h>
#include <DB/Core/ColumnsWithNameAndType.h>
#include <DB/Core/ColumnsWithTypeAndName.h>
#include <DB/DataTypes/IDataType.h>
@ -54,7 +54,7 @@ public:
* Осмысленные типы элементов в out_prerequisites: APPLY_FUNCTION, ADD_COLUMN.
*/
virtual void getReturnTypeAndPrerequisites(
const ColumnsWithNameAndType & arguments,
const ColumnsWithTypeAndName & arguments,
DataTypePtr & out_return_type,
std::vector<ExpressionAction> & out_prerequisites)
{

View File

@ -4,7 +4,7 @@
#include <DB/DataStreams/IBlockInputStream.h>
#include <DB/Interpreters/Settings.h>
#include <DB/Core/Names.h>
#include <DB/Core/ColumnWithNameAndType.h>
#include <DB/Core/ColumnWithTypeAndName.h>
#include <DB/Core/Block.h>
#include <unordered_set>
@ -77,7 +77,7 @@ public:
/// Если result_name_ == "", в качестве имени используется "имя_функции(аргументы через запятую)".
static ExpressionAction applyFunction(FunctionPtr function_, const std::vector<std::string> & argument_names_, std::string result_name_ = "");
static ExpressionAction addColumn(ColumnWithNameAndType added_column_)
static ExpressionAction addColumn(ColumnWithTypeAndName added_column_)
{
ExpressionAction a;
a.type = ADD_COLUMN;
@ -168,11 +168,11 @@ public:
: input_columns(input_columns_), settings(settings_)
{
for (const auto & input_elem : input_columns)
sample_block.insert(ColumnWithNameAndType(nullptr, input_elem.type, input_elem.name));
sample_block.insert(ColumnWithTypeAndName(nullptr, input_elem.type, input_elem.name));
}
/// Для константных столбцов в input_columns_ могут содержаться сами столбцы.
ExpressionActions(const ColumnsWithNameAndType & input_columns_, const Settings & settings_)
ExpressionActions(const ColumnsWithTypeAndName & input_columns_, const Settings & settings_)
: settings(settings_)
{
for (const auto & input_elem : input_columns_)
@ -185,7 +185,7 @@ public:
/// Добавить входной столбец.
/// Название столбца не должно совпадать с названиями промежуточных столбцов, возникающих при вычислении выражения.
/// В выражении не должно быть действий PROJECT.
void addInput(const ColumnWithNameAndType & column);
void addInput(const ColumnWithTypeAndName & column);
void addInput(const NameAndTypePair & column);
void add(const ExpressionAction & action);

View File

@ -44,7 +44,7 @@ private:
{
Block block;
ColumnWithNameAndType col;
ColumnWithTypeAndName col;
col.name = "name";
col.type = new DataTypeString;
col.column = col.type->createColumn();
@ -78,10 +78,10 @@ private:
column_defaults = table->column_defaults;
}
ColumnWithNameAndType name_column{new ColumnString, new DataTypeString, "name"};
ColumnWithNameAndType type_column{new ColumnString, new DataTypeString, "type" };
ColumnWithNameAndType default_type_column{new ColumnString, new DataTypeString, "default_type" };
ColumnWithNameAndType default_expression_column{new ColumnString, new DataTypeString, "default_expression" };;
ColumnWithTypeAndName name_column{new ColumnString, new DataTypeString, "name"};
ColumnWithTypeAndName type_column{new ColumnString, new DataTypeString, "type" };
ColumnWithTypeAndName default_type_column{new ColumnString, new DataTypeString, "default_type" };
ColumnWithTypeAndName default_expression_column{new ColumnString, new DataTypeString, "default_expression" };;
for (const auto column : columns)
{

View File

@ -39,7 +39,7 @@ private:
Block getSampleBlock()
{
ColumnWithNameAndType col;
ColumnWithTypeAndName col;
col.name = "result";
col.type = new DataTypeUInt8;
col.column = col.type->createColumn();
@ -56,7 +56,7 @@ private:
bool res = context.isTableExist(ast.database, ast.table);
ColumnWithNameAndType col;
ColumnWithTypeAndName col;
col.name = "result";
col.type = new DataTypeUInt8;
col.column = new ColumnConstUInt8(1, res);

View File

@ -40,7 +40,7 @@ private:
Block getSampleBlock()
{
ColumnWithNameAndType col;
ColumnWithTypeAndName col;
col.name = "statement";
col.type = new DataTypeString;
col.column = col.type->createColumn();
@ -59,7 +59,7 @@ private:
formatAST(*context.getCreateQuery(ast.database, ast.table), stream, 0, false, true);
String res = stream.str();
ColumnWithNameAndType col;
ColumnWithTypeAndName col;
col.name = "statement";
col.type = new DataTypeString;
col.column = new ColumnConstString(1, res);

View File

@ -305,7 +305,7 @@ protected:
size_t rows = 0;
for (size_t i = 0; i < res.columns(); ++i)
{
ColumnWithNameAndType & column = res.getByPosition(i);
ColumnWithTypeAndName & column = res.getByPosition(i);
if (column.name == prewhere_column && res.columns() > 1)
continue;
column.column = column.column->filter(column_name_set.count(column.name) ? post_filter : pre_filter);

View File

@ -92,7 +92,7 @@ public:
/// Все столбцы уже есть в блоке. Будем добавлять значения в конец.
bool append = res.has(it.name);
ColumnWithNameAndType column;
ColumnWithTypeAndName column;
column.name = it.name;
column.type = it.type;
if (append)
@ -487,7 +487,7 @@ private:
OffsetColumns offset_columns;
for (size_t i = 0; i < res.columns(); ++i)
{
const ColumnWithNameAndType & column = res.getByPosition(i);
const ColumnWithTypeAndName & column = res.getByPosition(i);
if (const ColumnArray * array = typeid_cast<const ColumnArray *>(&*column.column))
{
String offsets_name = DataTypeNested::extractNestedTableName(column.name);
@ -514,7 +514,7 @@ private:
continue;
}
ColumnWithNameAndType column_to_add;
ColumnWithTypeAndName column_to_add;
column_to_add.name = requested_column.name;
column_to_add.type = requested_column.type;

View File

@ -283,7 +283,7 @@ public:
size_t rows = block.rows();
/// Сначала пишем индекс. Индекс содержит значение Primary Key для каждой index_granularity строки.
typedef std::vector<const ColumnWithNameAndType *> PrimaryColumns;
typedef std::vector<const ColumnWithTypeAndName *> PrimaryColumns;
PrimaryColumns primary_columns;
for (const auto & descr : storage.getSortDescription())
@ -311,7 +311,7 @@ public:
/// Теперь пишем данные.
for (const auto & it : columns_list)
{
const ColumnWithNameAndType & column = block.getByName(it.name);
const ColumnWithTypeAndName & column = block.getByName(it.name);
writeData(column.name, *column.type, *column.column, offset_columns);
}
@ -435,7 +435,7 @@ public:
OffsetColumns offset_columns;
for (size_t i = 0; i < block.columns(); ++i)
{
const ColumnWithNameAndType & column = block.getByPosition(i);
const ColumnWithTypeAndName & column = block.getByPosition(i);
writeData(column.name, *column.type, *column.column, offset_columns);
}

View File

@ -51,7 +51,7 @@ void Block::addDefaults(const NamesAndTypesList & required_columns)
if (has(requested_column.name))
continue;
ColumnWithNameAndType column_to_add;
ColumnWithTypeAndName column_to_add;
column_to_add.name = requested_column.name;
column_to_add.type = requested_column.type;
@ -101,7 +101,7 @@ Block & Block::operator= (const Block & other)
return *this;
}
void Block::insert(size_t position, const ColumnWithNameAndType & elem)
void Block::insert(size_t position, const ColumnWithTypeAndName & elem)
{
if (position > index_by_position.size())
throw Exception("Position out of bound in Block::insert(), max position = "
@ -124,7 +124,7 @@ void Block::insert(size_t position, const ColumnWithNameAndType & elem)
}
void Block::insert(const ColumnWithNameAndType & elem)
void Block::insert(const ColumnWithTypeAndName & elem)
{
Container_t::iterator it = data.insert(data.end(), elem);
index_by_name[elem.name] = it;
@ -132,7 +132,7 @@ void Block::insert(const ColumnWithNameAndType & elem)
}
void Block::insertUnique(const ColumnWithNameAndType & elem)
void Block::insertUnique(const ColumnWithTypeAndName & elem)
{
if (index_by_name.end() == index_by_name.find(elem.name))
insert(elem);
@ -175,7 +175,7 @@ void Block::erase(const String & name)
}
ColumnWithNameAndType & Block::getByPosition(size_t position)
ColumnWithTypeAndName & Block::getByPosition(size_t position)
{
if (position >= index_by_position.size())
throw Exception("Position " + toString(position)
@ -187,7 +187,7 @@ ColumnWithNameAndType & Block::getByPosition(size_t position)
}
const ColumnWithNameAndType & Block::getByPosition(size_t position) const
const ColumnWithTypeAndName & Block::getByPosition(size_t position) const
{
if (position >= index_by_position.size())
throw Exception("Position " + toString(position)
@ -199,7 +199,7 @@ const ColumnWithNameAndType & Block::getByPosition(size_t position) const
}
ColumnWithNameAndType & Block::getByName(const std::string & name)
ColumnWithTypeAndName & Block::getByName(const std::string & name)
{
IndexByName_t::const_iterator it = index_by_name.find(name);
if (index_by_name.end() == it)
@ -210,7 +210,7 @@ ColumnWithNameAndType & Block::getByName(const std::string & name)
}
const ColumnWithNameAndType & Block::getByName(const std::string & name) const
const ColumnWithTypeAndName & Block::getByName(const std::string & name) const
{
IndexByName_t::const_iterator it = index_by_name.find(name);
if (index_by_name.end() == it)
@ -330,9 +330,9 @@ Block Block::sortColumns() const
}
ColumnsWithNameAndType Block::getColumns() const
ColumnsWithTypeAndName Block::getColumns() const
{
return ColumnsWithNameAndType(data.begin(), data.end());
return ColumnsWithTypeAndName(data.begin(), data.end());
}

View File

@ -37,7 +37,7 @@ Block AggregatingSortedBlockInputStream::readImpl()
/// Заполним номера столбцов, которые нужно доагрегировать.
for (size_t i = 0; i < num_columns; ++i)
{
ColumnWithNameAndType & column = merged_block.getByPosition(i);
ColumnWithTypeAndName & column = merged_block.getByPosition(i);
/// Оставляем только состояния аггрегатных функций.
if (strncmp(column.type->getName().data(), "AggregateFunction", strlen("AggregateFunction")) != 0)

View File

@ -75,7 +75,7 @@ Block FilterBlockInputStream::readImpl()
size_t filtered_rows = 0;
if (first_non_constant_column != static_cast<size_t>(filter_column))
{
ColumnWithNameAndType & current_column = res.getByPosition(first_non_constant_column);
ColumnWithTypeAndName & current_column = res.getByPosition(first_non_constant_column);
current_column.column = current_column.column->filter(filter);
filtered_rows = current_column.column->size();
}
@ -100,7 +100,7 @@ Block FilterBlockInputStream::readImpl()
/// Фильтруем остальные столбцы.
for (size_t i = 0; i < columns; ++i)
{
ColumnWithNameAndType & current_column = res.getByPosition(i);
ColumnWithTypeAndName & current_column = res.getByPosition(i);
if (i == static_cast<size_t>(filter_column))
{

View File

@ -58,7 +58,7 @@ void JSONCompactRowOutputStream::writeTotals()
if (i != 0)
writeChar(',', *ostr);
const ColumnWithNameAndType & column = totals.getByPosition(i);
const ColumnWithTypeAndName & column = totals.getByPosition(i);
column.type->serializeTextJSON((*column.column)[0], *ostr);
}
@ -79,7 +79,7 @@ static void writeExtremesElement(const char * title, const Block & extremes, siz
if (i != 0)
writeChar(',', ostr);
const ColumnWithNameAndType & column = extremes.getByPosition(i);
const ColumnWithTypeAndName & column = extremes.getByPosition(i);
column.type->serializeTextJSON((*column.column)[row_num], ostr);
}

View File

@ -139,7 +139,7 @@ void JSONRowOutputStream::writeTotals()
size_t totals_columns = totals.columns();
for (size_t i = 0; i < totals_columns; ++i)
{
const ColumnWithNameAndType & column = totals.getByPosition(i);
const ColumnWithTypeAndName & column = totals.getByPosition(i);
if (i != 0)
writeCString(",\n", *ostr);
@ -166,7 +166,7 @@ static void writeExtremesElement(const char * title, const Block & extremes, siz
size_t extremes_columns = extremes.columns();
for (size_t i = 0; i < extremes_columns; ++i)
{
const ColumnWithNameAndType & column = extremes.getByPosition(i);
const ColumnWithTypeAndName & column = extremes.getByPosition(i);
if (i != 0)
writeCString(",\n", ostr);

View File

@ -62,7 +62,7 @@ Block NativeBlockInputStream::readImpl()
for (size_t i = 0; i < columns; ++i)
{
ColumnWithNameAndType column;
ColumnWithTypeAndName column;
/// Имя
readStringBinary(column.name, istr);

View File

@ -76,7 +76,7 @@ void NativeBlockOutputStream::write(const Block & block)
for (size_t i = 0; i < columns; ++i)
{
const ColumnWithNameAndType & column = block.getByPosition(i);
const ColumnWithTypeAndName & column = block.getByPosition(i);
/// Имя
writeStringBinary(column.name, ostr);

View File

@ -32,7 +32,7 @@ void PrettyBlockOutputStream::calculateWidths(Block & block, Widths_t & max_widt
/// Вычислим ширину всех значений
for (size_t i = 0; i < columns; ++i)
{
ColumnWithNameAndType column;
ColumnWithTypeAndName column;
column.type = visible_width_type;
column.name = "visibleWidth(" + block.getByPosition(i).name + ")";
@ -137,7 +137,7 @@ void PrettyBlockOutputStream::write(const Block & block_)
if (i != 0)
writeCString("", ostr);
const ColumnWithNameAndType & col = block.getByPosition(i);
const ColumnWithTypeAndName & col = block.getByPosition(i);
if (!no_escapes)
writeCString("\033[1m", ostr);
@ -176,7 +176,7 @@ void PrettyBlockOutputStream::write(const Block & block_)
if (j != 0)
writeCString("", ostr);
const ColumnWithNameAndType & col = block.getByPosition(j);
const ColumnWithTypeAndName & col = block.getByPosition(j);
if (col.type->isNumeric())
{

View File

@ -21,7 +21,7 @@ void PrettyCompactBlockOutputStream::writeHeader(
if (i != 0)
writeCString("─┬─", ostr);
const ColumnWithNameAndType & col = block.getByPosition(i);
const ColumnWithTypeAndName & col = block.getByPosition(i);
if (col.type->isNumeric())
{
@ -83,7 +83,7 @@ void PrettyCompactBlockOutputStream::writeRow(
if (j != 0)
writeCString("", ostr);
const ColumnWithNameAndType & col = block.getByPosition(j);
const ColumnWithTypeAndName & col = block.getByPosition(j);
if (col.type->isNumeric())
{

View File

@ -40,7 +40,7 @@ void PrettySpaceBlockOutputStream::write(const Block & block_)
if (i != 0)
writeCString(" ", ostr);
const ColumnWithNameAndType & col = block.getByPosition(i);
const ColumnWithTypeAndName & col = block.getByPosition(i);
if (col.type->isNumeric())
{
@ -74,7 +74,7 @@ void PrettySpaceBlockOutputStream::write(const Block & block_)
if (j != 0)
writeCString(" ", ostr);
const ColumnWithNameAndType & col = block.getByPosition(j);
const ColumnWithTypeAndName & col = block.getByPosition(j);
if (col.type->isNumeric())
{

View File

@ -63,7 +63,7 @@ Block SummingSortedBlockInputStream::readImpl()
*/
for (size_t i = 0; i < num_columns; ++i)
{
ColumnWithNameAndType & column = merged_block.getByPosition(i);
ColumnWithTypeAndName & column = merged_block.getByPosition(i);
/// Discover nested Maps and find columns for summation
if (const auto array_type = typeid_cast<const DataTypeArray *>(column.type.get()))

View File

@ -9,7 +9,7 @@ void TabSeparatedBlockOutputStream::write(const Block & block)
size_t columns = block.columns();
for (size_t i = 0; i < columns; ++i)
{
const ColumnWithNameAndType & col = block.getByPosition(i);
const ColumnWithTypeAndName & col = block.getByPosition(i);
size_t rows = block.rows();
for (size_t j = 0; j < rows; ++j)

View File

@ -9,7 +9,7 @@ static void finalize(Block & block)
{
for (size_t i = 0; i < block.columns(); ++i)
{
ColumnWithNameAndType & current = block.getByPosition(i);
ColumnWithTypeAndName & current = block.getByPosition(i);
ColumnAggregateFunction * unfinalized_column = typeid_cast<ColumnAggregateFunction *>(&*current.column);
if (unfinalized_column)
{
@ -106,7 +106,7 @@ Block TotalsHavingBlockInputStream::readImpl()
for (size_t i = 0; i < columns; ++i)
{
ColumnWithNameAndType & current_column = finalized.getByPosition(i);
ColumnWithTypeAndName & current_column = finalized.getByPosition(i);
current_column.column = current_column.column->filter(filter);
if (current_column.column->empty())
{
@ -134,7 +134,7 @@ void TotalsHavingBlockInputStream::addToTotals(Block & totals, Block & block, co
for (size_t i = 0; i < block.columns(); ++i)
{
const ColumnWithNameAndType & current = block.getByPosition(i);
const ColumnWithTypeAndName & current = block.getByPosition(i);
const ColumnAggregateFunction * column = typeid_cast<const ColumnAggregateFunction *>(&*current.column);
if (!column)
@ -143,7 +143,7 @@ void TotalsHavingBlockInputStream::addToTotals(Block & totals, Block & block, co
{
ColumnPtr new_column = current.type->createColumn();
new_column->insertDefault();
totals.insert(ColumnWithNameAndType(new_column, current.type, current.name));
totals.insert(ColumnWithTypeAndName(new_column, current.type, current.name));
}
continue;
}
@ -156,7 +156,7 @@ void TotalsHavingBlockInputStream::addToTotals(Block & totals, Block & block, co
{
function = column->getAggregateFunction();
target = new ColumnAggregateFunction(column->getAggregateFunction(), Arenas(1, arena));
totals.insert(ColumnWithNameAndType(target, current.type, current.name));
totals.insert(ColumnWithTypeAndName(target, current.type, current.name));
data = arena->alloc(function->sizeOfData());
function->create(data);

View File

@ -31,7 +31,7 @@ int main(int argc, char ** argv)
Block block;
ColumnWithNameAndType column_x;
ColumnWithTypeAndName column_x;
column_x.name = "x";
column_x.type = new DataTypeInt16;
ColumnInt16 * x = new ColumnInt16;
@ -46,7 +46,7 @@ int main(int argc, char ** argv)
const char * strings[] = {"abc", "def", "abcd", "defg", "ac"};
ColumnWithNameAndType column_s1;
ColumnWithTypeAndName column_s1;
column_s1.name = "s1";
column_s1.type = new DataTypeString;
column_s1.column = new ColumnString;
@ -56,7 +56,7 @@ int main(int argc, char ** argv)
block.insert(column_s1);
ColumnWithNameAndType column_s2;
ColumnWithTypeAndName column_s2;
column_s2.name = "s2";
column_s2.type = new DataTypeString;
column_s2.column = new ColumnString;
@ -86,7 +86,7 @@ int main(int argc, char ** argv)
Block sample;
for (DataTypes::const_iterator it = result_types->begin(); it != result_types->end(); ++it)
{
ColumnWithNameAndType col;
ColumnWithTypeAndName col;
col.type = *it;
sample.insert(col);
}

View File

@ -7,7 +7,7 @@
#include <Poco/SharedPtr.h>
#include <DB/Core/Block.h>
#include <DB/Core/ColumnWithNameAndType.h>
#include <DB/Core/ColumnWithTypeAndName.h>
#include <DB/IO/ReadBufferFromIStream.h>
#include <DB/IO/WriteBufferFromOStream.h>
@ -28,13 +28,13 @@ int main(int argc, char ** argv)
{
DB::Block sample;
DB::ColumnWithNameAndType col1;
DB::ColumnWithTypeAndName col1;
col1.name = "col1";
col1.type = new DB::DataTypeUInt64;
col1.column = col1.type->createColumn();
sample.insert(col1);
DB::ColumnWithNameAndType col2;
DB::ColumnWithTypeAndName col2;
col2.name = "col2";
col2.type = new DB::DataTypeString;
col2.column = col2.type->createColumn();

View File

@ -98,7 +98,7 @@ int main(int argc, char ** argv)
Block sample;
for (NamesAndTypesList::const_iterator it = names_and_types_list->begin(); it != names_and_types_list->end(); ++it)
{
ColumnWithNameAndType elem;
ColumnWithTypeAndName elem;
elem.name = it->name;
elem.type = it->type;
elem.column = elem.type->createColumn();

View File

@ -32,7 +32,7 @@ int main(int argc, char ** argv)
Block block1;
{
ColumnWithNameAndType column1;
ColumnWithTypeAndName column1;
column1.name = "Sign";
column1.type = new DataTypeInt8;
column1.column = new ColumnInt8;
@ -40,7 +40,7 @@ int main(int argc, char ** argv)
column1.column->insert(DB::Int64(-1));
block1.insert(column1);
ColumnWithNameAndType column2;
ColumnWithTypeAndName column2;
column2.name = "CounterID";
column2.type = new DataTypeUInt32;
column2.column = new ColumnUInt32;
@ -52,7 +52,7 @@ int main(int argc, char ** argv)
Block block2;
{
ColumnWithNameAndType column1;
ColumnWithTypeAndName column1;
column1.name = "Sign";
column1.type = new DataTypeInt8;
column1.column = new ColumnInt8;
@ -60,7 +60,7 @@ int main(int argc, char ** argv)
column1.column->insert(DB::Int64(1));
block2.insert(column1);
ColumnWithNameAndType column2;
ColumnWithTypeAndName column2;
column2.name = "CounterID";
column2.type = new DataTypeUInt32;
column2.column = new ColumnUInt32;

View File

@ -51,7 +51,7 @@ int main(int argc, char ** argv)
Block sample;
for (NamesAndTypesList::const_iterator it = names_and_types_list->begin(); it != names_and_types_list->end(); ++it)
{
ColumnWithNameAndType elem;
ColumnWithTypeAndName elem;
elem.name = it->name;
elem.type = it->type;
elem.column = elem.type->createColumn();

View File

@ -136,7 +136,7 @@ int main(int argc, char ** argv)
Block sample;
for (DataTypes::const_iterator it = result_types->begin(); it != result_types->end(); ++it)
{
ColumnWithNameAndType col;
ColumnWithTypeAndName col;
col.type = *it;
sample.insert(col);
}

View File

@ -21,12 +21,12 @@ int main(int argc, char ** argv)
{
DB::Block sample;
{
DB::ColumnWithNameAndType col;
DB::ColumnWithTypeAndName col;
col.type = new DB::DataTypeUInt64;
sample.insert(col);
}
{
DB::ColumnWithNameAndType col;
DB::ColumnWithTypeAndName col;
col.type = new DB::DataTypeString;
sample.insert(col);
}

View File

@ -189,12 +189,12 @@ void FunctionVisibleWidth::execute(Block & block, const ColumnNumbers & argument
{
/// Вычисляем видимую ширину для значений массива.
Block nested_block;
ColumnWithNameAndType nested_values;
ColumnWithTypeAndName nested_values;
nested_values.type = typeid_cast<const DataTypeArray &>(*type).getNestedType();
nested_values.column = col->getDataPtr();
nested_block.insert(nested_values);
ColumnWithNameAndType nested_result;
ColumnWithTypeAndName nested_result;
nested_result.type = new DataTypeUInt64;
nested_block.insert(nested_result);
@ -253,7 +253,7 @@ void FunctionVisibleWidth::execute(Block & block, const ColumnNumbers & argument
* x1, x2, x3... , width1, width2, width1 + width2, width3, width1 + width2 + width3, ...
*/
ColumnWithNameAndType nested_result;
ColumnWithTypeAndName nested_result;
nested_result.type = new DataTypeUInt64;
nested_block.insert(nested_result);
@ -262,7 +262,7 @@ void FunctionVisibleWidth::execute(Block & block, const ColumnNumbers & argument
if (i != 0)
{
ColumnWithNameAndType plus_result;
ColumnWithTypeAndName plus_result;
plus_result.type = new DataTypeUInt64;
nested_block.insert(plus_result);

View File

@ -12,14 +12,14 @@ int main(int argc, char ** argv)
{
size_t n = atoi(argv[1]);
DB::ColumnWithNameAndType descr1;
DB::ColumnWithTypeAndName descr1;
DB::ColumnUInt8 * col1 = new DB::ColumnUInt8;
descr1.type = new DB::DataTypeUInt8;
descr1.column = col1;
descr1.name = "x";
col1->getData().resize(n);
DB::ColumnWithNameAndType descr2;
DB::ColumnWithTypeAndName descr2;
DB::ColumnInt16 * col2 = new DB::ColumnInt16;
descr2.type = new DB::DataTypeInt16;
descr2.column = col2;
@ -49,7 +49,7 @@ int main(int argc, char ** argv)
DB::DataTypePtr res_type = f.getReturnType(arg_types);
DB::ColumnWithNameAndType descr_res;
DB::ColumnWithTypeAndName descr_res;
descr_res.type = res_type;
descr_res.name = "z";

View File

@ -337,7 +337,7 @@ int main(int argc, char ** argv)
for (size_t i = 0; i < columns; ++i)
{
ColumnVector<UInt8> * column = new ColumnVector<UInt8>(block_size);
blocks[b].insert(ColumnWithNameAndType(column, new DataTypeUInt8, "v" + toString(i)));
blocks[b].insert(ColumnWithTypeAndName(column, new DataTypeUInt8, "v" + toString(i)));
ColumnVector<UInt8>::Container_t & vec = column->getData();
vec.resize(block_size);
@ -351,7 +351,7 @@ int main(int argc, char ** argv)
for (size_t b = 0; b < block_count; ++b)
{
ColumnVector<UInt8> * result_column = new ColumnVector<UInt8>;
blocks[b].insert(ColumnWithNameAndType(result_column, new DataTypeUInt8, "x"));
blocks[b].insert(ColumnWithTypeAndName(result_column, new DataTypeUInt8, "x"));
result_column->getData().resize(block_size);
}

View File

@ -121,7 +121,7 @@ void Aggregator::initialize(Block & block)
for (size_t i = 0; i < aggregates_size; ++i)
{
ColumnWithNameAndType col;
ColumnWithTypeAndName col;
col.name = aggregates[i].column_name;
size_t arguments_size = aggregates[i].arguments.size();
@ -848,7 +848,7 @@ Block Aggregator::prepareBlockAndFill(
}
else
{
ColumnWithNameAndType & column = res.getByPosition(i + keys_size);
ColumnWithTypeAndName & column = res.getByPosition(i + keys_size);
column.type = aggregate_functions[i]->getReturnType();
column.column = column.type->createColumn();
column.column->reserve(rows);

View File

@ -61,7 +61,7 @@ ExpressionActions::Actions ExpressionAction::getPrerequisites(Block & sample_blo
if (sample_block.has(result_name))
throw Exception("Column '" + result_name + "' already exists", ErrorCodes::DUPLICATE_COLUMN);
ColumnsWithNameAndType arguments(argument_names.size());
ColumnsWithTypeAndName arguments(argument_names.size());
for (size_t i = 0; i < argument_names.size(); ++i)
{
if (!sample_block.has(argument_names[i]))
@ -126,7 +126,7 @@ void ExpressionAction::prepare(Block & sample_block)
{
size_t result_position = sample_block.columns();
ColumnWithNameAndType new_column;
ColumnWithTypeAndName new_column;
new_column.name = result_name;
new_column.type = result_type;
sample_block.insert(new_column);
@ -134,13 +134,13 @@ void ExpressionAction::prepare(Block & sample_block)
function->execute(sample_block, arguments, prerequisites, result_position);
/// Если получилась не константа, на всякий случай будем считать результат неизвестным.
ColumnWithNameAndType & col = sample_block.getByPosition(result_position);
ColumnWithTypeAndName & col = sample_block.getByPosition(result_position);
if (!col.column->isConst())
col.column = nullptr;
}
else
{
sample_block.insert(ColumnWithNameAndType(nullptr, result_type, result_name));
sample_block.insert(ColumnWithTypeAndName(nullptr, result_type, result_name));
}
break;
@ -150,7 +150,7 @@ void ExpressionAction::prepare(Block & sample_block)
{
for (NameSet::iterator it = array_joined_columns.begin(); it != array_joined_columns.end(); ++it)
{
ColumnWithNameAndType & current = sample_block.getByName(*it);
ColumnWithTypeAndName & current = sample_block.getByName(*it);
const DataTypeArray * array_type = typeid_cast<const DataTypeArray *>(&*current.type);
if (!array_type)
throw Exception("ARRAY JOIN requires array argument", ErrorCodes::TYPE_MISMATCH);
@ -164,7 +164,7 @@ void ExpressionAction::prepare(Block & sample_block)
case JOIN:
{
for (const auto & col : columns_added_by_join)
sample_block.insert(ColumnWithNameAndType(nullptr, col.type, col.name));
sample_block.insert(ColumnWithTypeAndName(nullptr, col.type, col.name));
break;
}
@ -177,7 +177,7 @@ void ExpressionAction::prepare(Block & sample_block)
{
const std::string & name = projection[i].first;
const std::string & alias = projection[i].second;
ColumnWithNameAndType column = sample_block.getByName(name);
ColumnWithTypeAndName column = sample_block.getByName(name);
if (alias != "")
column.name = alias;
new_block.insert(column);
@ -198,14 +198,14 @@ void ExpressionAction::prepare(Block & sample_block)
if (sample_block.has(result_name))
throw Exception("Column '" + result_name + "' already exists", ErrorCodes::DUPLICATE_COLUMN);
sample_block.insert(ColumnWithNameAndType(added_column, result_type, result_name));
sample_block.insert(ColumnWithTypeAndName(added_column, result_type, result_name));
break;
}
case COPY_COLUMN:
{
result_type = sample_block.getByName(source_name).type;
sample_block.insert(ColumnWithNameAndType(sample_block.getByName(source_name).column, result_type, result_name));
sample_block.insert(ColumnWithTypeAndName(sample_block.getByName(source_name).column, result_type, result_name));
break;
}
@ -246,7 +246,7 @@ void ExpressionAction::execute(Block & block) const
prerequisites[i] = block.getPositionByName(prerequisite_names[i]);
}
ColumnWithNameAndType new_column;
ColumnWithTypeAndName new_column;
new_column.name = result_name;
new_column.type = result_type;
block.insert(new_column);
@ -271,7 +271,7 @@ void ExpressionAction::execute(Block & block) const
size_t columns = block.columns();
for (size_t i = 0; i < columns; ++i)
{
ColumnWithNameAndType & current = block.getByPosition(i);
ColumnWithTypeAndName & current = block.getByPosition(i);
if (array_joined_columns.count(current.name))
{
@ -312,7 +312,7 @@ void ExpressionAction::execute(Block & block) const
{
const std::string & name = projection[i].first;
const std::string & alias = projection[i].second;
ColumnWithNameAndType column = block.getByName(name);
ColumnWithTypeAndName column = block.getByName(name);
if (alias != "")
column.name = alias;
new_block.insert(column);
@ -328,11 +328,11 @@ void ExpressionAction::execute(Block & block) const
break;
case ADD_COLUMN:
block.insert(ColumnWithNameAndType(added_column->cloneResized(block.rowsInFirstColumn()), result_type, result_name));
block.insert(ColumnWithTypeAndName(added_column->cloneResized(block.rowsInFirstColumn()), result_type, result_name));
break;
case COPY_COLUMN:
block.insert(ColumnWithNameAndType(block.getByName(source_name).column, result_type, result_name));
block.insert(ColumnWithTypeAndName(block.getByName(source_name).column, result_type, result_name));
break;
default:
@ -446,7 +446,7 @@ void ExpressionActions::checkLimits(Block & block) const
}
}
void ExpressionActions::addInput(const ColumnWithNameAndType & column)
void ExpressionActions::addInput(const ColumnWithTypeAndName & column)
{
input_columns.emplace_back(column.name, column.type);
sample_block.insert(column);
@ -454,7 +454,7 @@ void ExpressionActions::addInput(const ColumnWithNameAndType & column)
void ExpressionActions::addInput(const NameAndTypePair & column)
{
addInput(ColumnWithNameAndType(nullptr, column.type, column.name));
addInput(ColumnWithTypeAndName(nullptr, column.type, column.name));
}
void ExpressionActions::add(const ExpressionAction & action, Names & out_new_columns)
@ -573,7 +573,7 @@ void ExpressionActions::executeOnTotals(Block & block) const
{
for (const auto & name_and_type : input_columns)
{
ColumnWithNameAndType elem(name_and_type.type->createColumn(), name_and_type.type, name_and_type.name);
ColumnWithTypeAndName elem(name_and_type.type->createColumn(), name_and_type.type, name_and_type.name);
elem.column->insertDefault();
block.insert(elem);
}
@ -903,7 +903,7 @@ BlockInputStreamPtr ExpressionActions::createStreamWithNonJoinedDataIfFullOrRigh
{
Block left_sample_block;
for (const auto & input_elem : input_columns)
left_sample_block.insert(ColumnWithNameAndType(nullptr, input_elem.type, input_elem.name));
left_sample_block.insert(ColumnWithTypeAndName(nullptr, input_elem.type, input_elem.name));
return action.join->createStreamWithNonJoinedRows(left_sample_block, max_block_size);
}
@ -918,7 +918,7 @@ void ExpressionActionsChain::addStep()
if (steps.empty())
throw Exception("Cannot add action to empty ExpressionActionsChain", ErrorCodes::LOGICAL_ERROR);
ColumnsWithNameAndType columns = steps.back().actions->getSampleBlock().getColumns();
ColumnsWithTypeAndName columns = steps.back().actions->getSampleBlock().getColumns();
steps.push_back(Step(new ExpressionActions(columns, settings)));
}

View File

@ -1011,7 +1011,7 @@ struct ExpressionAnalyzer::ScopeStack
stack.emplace_back();
Level & prev = stack[stack.size() - 2];
ColumnsWithNameAndType all_columns;
ColumnsWithTypeAndName all_columns;
NameSet new_names;
for (NamesAndTypesList::const_iterator it = input_columns.begin(); it != input_columns.end(); ++it)
@ -1024,7 +1024,7 @@ struct ExpressionAnalyzer::ScopeStack
const Block & prev_sample_block = prev.actions->getSampleBlock();
for (size_t i = 0, size = prev_sample_block.columns(); i < size; ++i)
{
const ColumnWithNameAndType & col = prev_sample_block.unsafeGetByPosition(i);
const ColumnWithTypeAndName & col = prev_sample_block.unsafeGetByPosition(i);
if (!new_names.count(col.name))
all_columns.push_back(col);
}
@ -1057,7 +1057,7 @@ struct ExpressionAnalyzer::ScopeStack
for (size_t i = 0; i < added.size(); ++i)
{
const ColumnWithNameAndType & col = stack[level].actions->getSampleBlock().getByName(added[i]);
const ColumnWithTypeAndName & col = stack[level].actions->getSampleBlock().getByName(added[i]);
for (size_t j = level + 1; j < stack.size(); ++j)
stack[j].actions->addInput(col);
}
@ -1234,7 +1234,7 @@ void ExpressionAnalyzer::getActionsImpl(ASTPtr ast, bool no_subqueries, bool onl
{
/// Мы в той части дерева, которую не собираемся вычислять. Нужно только определить типы.
/// Не будем выполнять подзапросы и составлять множества. Вставим произвольный столбец правильного типа.
ColumnWithNameAndType fake_column;
ColumnWithTypeAndName fake_column;
fake_column.name = node->getColumnName();
fake_column.type = new DataTypeUInt8;
actions_stack.addAction(ExpressionAction::addColumn(fake_column));
@ -1275,7 +1275,7 @@ void ExpressionAnalyzer::getActionsImpl(ASTPtr ast, bool no_subqueries, bool onl
}
else if (set)
{
ColumnWithNameAndType column;
ColumnWithTypeAndName column;
column.type = new DataTypeSet;
/// Если аргумент - множество, заданное перечислением значений, дадим ему уникальное имя,
@ -1370,7 +1370,7 @@ void ExpressionAnalyzer::getActionsImpl(ASTPtr ast, bool no_subqueries, bool onl
/// потому что оно не однозначно определяет выражение (типы аргументов могут быть разными).
argument_names[i] = getUniqueName(actions_stack.getSampleBlock(), "__lambda");
ColumnWithNameAndType lambda_column;
ColumnWithTypeAndName lambda_column;
lambda_column.column = new ColumnExpression(1, lambda_actions, lambda_arguments, result_type, result_name);
lambda_column.type = argument_types[i];
lambda_column.name = argument_names[i];
@ -1400,7 +1400,7 @@ void ExpressionAnalyzer::getActionsImpl(ASTPtr ast, bool no_subqueries, bool onl
{
DataTypePtr type = apply_visitor(FieldToDataType(), node->value);
ColumnWithNameAndType column;
ColumnWithTypeAndName column;
column.column = type->createConstColumn(1, node->value);
column.type = type;
column.name = node->getColumnName();

View File

@ -54,7 +54,7 @@ Block InterpreterInsertQuery::getSampleBlock()
if (!table_sample.has(current_name))
throw Exception("No such column " + current_name + " in table " + query.table, ErrorCodes::NO_SUCH_COLUMN_IN_TABLE);
ColumnWithNameAndType col;
ColumnWithTypeAndName col;
col.name = current_name;
col.type = table_sample.getByName(current_name).type;
col.column = col.type->createColumn();

View File

@ -299,7 +299,7 @@ Block InterpreterSelectQuery::getSampleBlock()
/// писать (читать) с помощью BlockOut(In)putStream'ов
for (size_t i = 0; i < block.columns(); ++i)
{
ColumnWithNameAndType & col = block.getByPosition(i);
ColumnWithTypeAndName & col = block.getByPosition(i);
col.column = col.type->createColumn();
}
return block;

View File

@ -553,8 +553,8 @@ void Join::joinBlockImpl(Block & block, const Maps & maps) const
for (size_t i = 0; i < num_columns_to_add; ++i)
{
const ColumnWithNameAndType & src_column = sample_block_with_columns_to_add.getByPosition(i);
ColumnWithNameAndType new_column = src_column.cloneEmpty();
const ColumnWithTypeAndName & src_column = sample_block_with_columns_to_add.getByPosition(i);
ColumnWithTypeAndName new_column = src_column.cloneEmpty();
block.insert(new_column);
added_columns[i] = new_column.column;
added_columns[i]->reserve(src_column.column->size());
@ -817,8 +817,8 @@ private:
for (size_t i = 0; i < num_columns_right; ++i)
{
const ColumnWithNameAndType & src_column = parent.sample_block_with_columns_to_add.getByPosition(i);
ColumnWithNameAndType new_column = src_column.cloneEmpty();
const ColumnWithTypeAndName & src_column = parent.sample_block_with_columns_to_add.getByPosition(i);
ColumnWithTypeAndName new_column = src_column.cloneEmpty();
block.insert(new_column);
columns_right[i] = new_column.column;
columns_right[i]->reserve(src_column.column->size());

View File

@ -435,7 +435,7 @@ void Set::createFromAST(DataTypes & types, ASTPtr node, const Context & context,
Block block;
for (size_t i = 0, size = data_types.size(); i < size; ++i)
{
ColumnWithNameAndType col;
ColumnWithTypeAndName col;
col.type = data_types[i];
col.column = data_types[i]->createColumn();
col.name = "_" + toString(i);

View File

@ -24,7 +24,7 @@ int main(int argc, char ** argv)
DB::Block block;
DB::ColumnWithNameAndType column_x;
DB::ColumnWithTypeAndName column_x;
column_x.name = "x";
column_x.type = new DB::DataTypeInt16;
DB::ColumnInt16 * x = new DB::ColumnInt16;
@ -39,7 +39,7 @@ int main(int argc, char ** argv)
const char * strings[] = {"abc", "def", "abcd", "defg", "ac"};
DB::ColumnWithNameAndType column_s1;
DB::ColumnWithTypeAndName column_s1;
column_s1.name = "s1";
column_s1.type = new DB::DataTypeString;
column_s1.column = new DB::ColumnString;
@ -49,7 +49,7 @@ int main(int argc, char ** argv)
block.insert(column_s1);
DB::ColumnWithNameAndType column_s2;
DB::ColumnWithTypeAndName column_s2;
column_s2.name = "s2";
column_s2.type = new DB::DataTypeString;
column_s2.column = new DB::ColumnString;

View File

@ -64,7 +64,7 @@ int main(int argc, char ** argv)
Block block;
ColumnWithNameAndType column_x;
ColumnWithTypeAndName column_x;
column_x.name = "x";
column_x.type = new DataTypeInt16;
ColumnInt16 * x = new ColumnInt16;
@ -79,7 +79,7 @@ int main(int argc, char ** argv)
const char * strings[] = {"abc", "def", "abcd", "defg", "ac"};
ColumnWithNameAndType column_s1;
ColumnWithTypeAndName column_s1;
column_s1.name = "s1";
column_s1.type = new DataTypeString;
column_s1.column = new ColumnString;
@ -89,7 +89,7 @@ int main(int argc, char ** argv)
block.insert(column_s1);
ColumnWithNameAndType column_s2;
ColumnWithTypeAndName column_s2;
column_s2.name = "s2";
column_s2.type = new DataTypeString;
column_s2.column = new ColumnString;

View File

@ -256,7 +256,7 @@ void ITableDeclaration::check(const Block & block, bool need_all) const
for (size_t i = 0; i < block.columns(); ++i)
{
const ColumnWithNameAndType & column = block.getByPosition(i);
const ColumnWithTypeAndName & column = block.getByPosition(i);
if (names_in_block.count(column.name))
throw Exception("Duplicate column " + column.name + " in block",

View File

@ -487,7 +487,7 @@ void MergeTreeData::createConvertExpression(const DataPartPtr & part, const Name
if (!out_expression)
out_expression = new ExpressionActions(NamesAndTypesList(), context.getSettingsRef());
out_expression->addInput(ColumnWithNameAndType(nullptr, column.type, column.name));
out_expression->addInput(ColumnWithTypeAndName(nullptr, column.type, column.name));
Names out_names;

View File

@ -26,7 +26,7 @@ MergeTreeDataSelectExecutor::MergeTreeDataSelectExecutor(MergeTreeData & data_)
static Block getBlockWithVirtualColumns(const MergeTreeData::DataPartsVector & parts)
{
Block res;
ColumnWithNameAndType _part(new ColumnString, new DataTypeString, "_part");
ColumnWithTypeAndName _part(new ColumnString, new DataTypeString, "_part");
for (const auto & part : parts)
_part.column->insert(part->name);

View File

@ -155,7 +155,7 @@ PKCondition::PKCondition(ASTPtr query, const Context & context_, const NamesAndT
Block block_with_constants;
/// В блоке должен быть хотя бы один столбец, чтобы у него было известно число строк.
ColumnWithNameAndType dummy_column;
ColumnWithTypeAndName dummy_column;
dummy_column.name = "_dummy";
dummy_column.type = new DataTypeUInt8;
dummy_column.column = new ColumnConstUInt8(1, 0);

View File

@ -84,7 +84,7 @@ protected:
for (const auto & name : column_names)
{
auto & col = buffer.data.getByName(name);
res.insert(ColumnWithNameAndType(col.column->clone(), col.type, name));
res.insert(ColumnWithTypeAndName(col.column->clone(), col.type, name));
}
return res;

View File

@ -207,7 +207,7 @@ BlockInputStreams StorageChunkMerger::read(
Block StorageChunkMerger::getBlockWithVirtualColumns(const Storages & selected_tables) const
{
Block res;
ColumnWithNameAndType _table(new ColumnString, new DataTypeString, _table_column_name);
ColumnWithTypeAndName _table(new ColumnString, new DataTypeString, _table_column_name);
for (Storages::const_iterator it = selected_tables.begin(); it != selected_tables.end(); ++it)
if ((*it)->getName() != "Chunks")

View File

@ -89,7 +89,7 @@ BlockInputStreams StorageChunks::read(
Block StorageChunks::getBlockWithVirtualColumns() const
{
Block res;
ColumnWithNameAndType _table(new ColumnString, new DataTypeString, _table_column_name);
ColumnWithTypeAndName _table(new ColumnString, new DataTypeString, _table_column_name);
for (const auto & it : chunk_names)
_table.column->insert(it);

View File

@ -212,7 +212,7 @@ Block LogBlockInputStream::readImpl()
if (*it == storage._table_column_name)
continue;
ColumnWithNameAndType column;
ColumnWithTypeAndName column;
column.name = *it;
column.type = storage.getDataTypeByName(*it);
@ -256,7 +256,7 @@ Block LogBlockInputStream::readImpl()
if (rows > 0)
{
ColumnPtr column_ptr = ColumnConst<String> (rows, current_table.first, new DataTypeString).convertToFullColumn();
ColumnWithNameAndType column(column_ptr, new DataTypeString, storage._table_column_name);
ColumnWithTypeAndName column(column_ptr, new DataTypeString, storage._table_column_name);
res.insert(column);
}
}
@ -341,7 +341,7 @@ void LogBlockOutputStream::write(const Block & block)
marks.reserve(storage.files.size());
for (size_t i = 0; i < block.columns(); ++i)
{
const ColumnWithNameAndType & column = block.getByPosition(i);
const ColumnWithTypeAndName & column = block.getByPosition(i);
writeData(column.name, *column.type, *column.column, marks, offset_columns);
}
writeMarks(marks);

View File

@ -186,7 +186,7 @@ BlockInputStreams StorageMerge::read(
Block StorageMerge::getBlockWithVirtualColumns(const std::vector<StoragePtr> & selected_tables) const
{
Block res;
ColumnWithNameAndType _table(new ColumnString, new DataTypeString, "_table");
ColumnWithTypeAndName _table(new ColumnString, new DataTypeString, "_table");
for (StorageVector::const_iterator it = selected_tables.begin(); it != selected_tables.end(); ++it)
_table.column->insert((*it)->getTableName());

View File

@ -2014,7 +2014,7 @@ BlockInputStreams StorageReplicatedMergeTree::read(
ColumnPtr column_ptr = column;
column->getData()[0] = 0;
column->getData()[1] = 1;
virtual_columns_block.insert(ColumnWithNameAndType(column_ptr, new DataTypeUInt8, "_replicated"));
virtual_columns_block.insert(ColumnWithTypeAndName(column_ptr, new DataTypeUInt8, "_replicated"));
/// Если запрошен хотя бы один виртуальный столбец, пробуем индексировать
if (!virt_column_names.empty())

View File

@ -113,14 +113,14 @@ BlockInputStreams StorageSystemClusters::read(
Block block;
block.insert(ColumnWithNameAndType(cluster_column, new DataTypeString, "cluster"));
block.insert(ColumnWithNameAndType(shard_num_column, new DataTypeUInt32, "shard_num"));
block.insert(ColumnWithNameAndType(shard_weight_column, new DataTypeUInt32, "shard_weight"));
block.insert(ColumnWithNameAndType(replica_num_column, new DataTypeUInt32, "replica_num"));
block.insert(ColumnWithNameAndType(host_name_column, new DataTypeString, "host_name"));
block.insert(ColumnWithNameAndType(host_address_column, new DataTypeString, "host_address"));
block.insert(ColumnWithNameAndType(port_column, new DataTypeUInt16, "port"));
block.insert(ColumnWithNameAndType(user_column, new DataTypeString, "user"));
block.insert(ColumnWithTypeAndName(cluster_column, new DataTypeString, "cluster"));
block.insert(ColumnWithTypeAndName(shard_num_column, new DataTypeUInt32, "shard_num"));
block.insert(ColumnWithTypeAndName(shard_weight_column, new DataTypeUInt32, "shard_weight"));
block.insert(ColumnWithTypeAndName(replica_num_column, new DataTypeUInt32, "replica_num"));
block.insert(ColumnWithTypeAndName(host_name_column, new DataTypeString, "host_name"));
block.insert(ColumnWithTypeAndName(host_address_column, new DataTypeString, "host_address"));
block.insert(ColumnWithTypeAndName(port_column, new DataTypeUInt16, "port"));
block.insert(ColumnWithTypeAndName(user_column, new DataTypeString, "user"));
return BlockInputStreams{ 1, new OneBlockInputStream(block) };
}

View File

@ -50,7 +50,7 @@ BlockInputStreams StorageSystemColumns::read(
ColumnPtr database_column = new ColumnString;
for (const auto & database : databases)
database_column->insert(database.first);
block.insert(ColumnWithNameAndType(database_column, new DataTypeString, "database"));
block.insert(ColumnWithTypeAndName(database_column, new DataTypeString, "database"));
/// Отфильтруем блок со столбцом database.
VirtualColumnUtils::filterBlockWithQuery(query, block, context);
@ -84,7 +84,7 @@ BlockInputStreams StorageSystemColumns::read(
column = column->replicate(offsets);
}
block.insert(ColumnWithNameAndType(table_column, new DataTypeString, "table"));
block.insert(ColumnWithTypeAndName(table_column, new DataTypeString, "table"));
}
/// Отфильтруем блок со столбцами database и table.
@ -145,12 +145,12 @@ BlockInputStreams StorageSystemColumns::read(
block.clear();
block.insert(ColumnWithNameAndType(database_column, new DataTypeString, "database"));
block.insert(ColumnWithNameAndType(table_column, new DataTypeString, "table"));
block.insert(ColumnWithNameAndType(name_column, new DataTypeString, "name"));
block.insert(ColumnWithNameAndType(type_column, new DataTypeString, "type"));
block.insert(ColumnWithNameAndType(default_type_column, new DataTypeString, "default_type"));
block.insert(ColumnWithNameAndType(default_expression_column, new DataTypeString, "default_expression"));
block.insert(ColumnWithTypeAndName(database_column, new DataTypeString, "database"));
block.insert(ColumnWithTypeAndName(table_column, new DataTypeString, "table"));
block.insert(ColumnWithTypeAndName(name_column, new DataTypeString, "name"));
block.insert(ColumnWithTypeAndName(type_column, new DataTypeString, "type"));
block.insert(ColumnWithTypeAndName(default_type_column, new DataTypeString, "default_type"));
block.insert(ColumnWithTypeAndName(default_expression_column, new DataTypeString, "default_expression"));
return BlockInputStreams{ 1, new OneBlockInputStream(block) };
}

View File

@ -33,7 +33,7 @@ BlockInputStreams StorageSystemDatabases::read(
Block block;
ColumnWithNameAndType col_name;
ColumnWithTypeAndName col_name;
col_name.name = "name";
col_name.type = new DataTypeString;
col_name.column = new ColumnString;

View File

@ -54,28 +54,28 @@ BlockInputStreams StorageSystemDictionaries::read(
check(column_names);
processed_stage = QueryProcessingStage::FetchColumns;
ColumnWithNameAndType col_name{new ColumnString, new DataTypeString, "name"};
ColumnWithNameAndType col_origin{new ColumnString, new DataTypeString, "origin"};
ColumnWithNameAndType col_type{new ColumnString, new DataTypeString, "type"};
ColumnWithNameAndType col_attribute_names{
ColumnWithTypeAndName col_name{new ColumnString, new DataTypeString, "name"};
ColumnWithTypeAndName col_origin{new ColumnString, new DataTypeString, "origin"};
ColumnWithTypeAndName col_type{new ColumnString, new DataTypeString, "type"};
ColumnWithTypeAndName col_attribute_names{
new ColumnArray{new ColumnString},
new DataTypeArray{new DataTypeString},
"attribute.names"
};
ColumnWithNameAndType col_attribute_types{
ColumnWithTypeAndName col_attribute_types{
new ColumnArray{new ColumnString},
new DataTypeArray{new DataTypeString},
"attribute.types"
};
ColumnWithNameAndType col_has_hierarchy{new ColumnUInt8, new DataTypeUInt8, "has_hierarchy"};
ColumnWithNameAndType col_bytes_allocated{new ColumnUInt64, new DataTypeUInt64, "bytes_allocated"};
ColumnWithNameAndType col_query_count{new ColumnUInt64, new DataTypeUInt64, "query_count"};
ColumnWithNameAndType col_hit_rate{new ColumnFloat64, new DataTypeFloat64, "hit_rate"};
ColumnWithNameAndType col_element_count{new ColumnUInt64, new DataTypeUInt64, "element_count"};
ColumnWithNameAndType col_load_factor{new ColumnFloat64, new DataTypeFloat64, "load_factor"};
ColumnWithNameAndType col_creation_time{new ColumnUInt32, new DataTypeDateTime, "creation_time"};
ColumnWithNameAndType col_last_exception{new ColumnString, new DataTypeString, "last_exception"};
ColumnWithNameAndType col_source{new ColumnString, new DataTypeString, "source"};
ColumnWithTypeAndName col_has_hierarchy{new ColumnUInt8, new DataTypeUInt8, "has_hierarchy"};
ColumnWithTypeAndName col_bytes_allocated{new ColumnUInt64, new DataTypeUInt64, "bytes_allocated"};
ColumnWithTypeAndName col_query_count{new ColumnUInt64, new DataTypeUInt64, "query_count"};
ColumnWithTypeAndName col_hit_rate{new ColumnFloat64, new DataTypeFloat64, "hit_rate"};
ColumnWithTypeAndName col_element_count{new ColumnUInt64, new DataTypeUInt64, "element_count"};
ColumnWithTypeAndName col_load_factor{new ColumnFloat64, new DataTypeFloat64, "load_factor"};
ColumnWithTypeAndName col_creation_time{new ColumnUInt32, new DataTypeDateTime, "creation_time"};
ColumnWithTypeAndName col_last_exception{new ColumnString, new DataTypeString, "last_exception"};
ColumnWithTypeAndName col_source{new ColumnString, new DataTypeString, "source"};
const auto & external_dictionaries = context.getExternalDictionaries();
const std::lock_guard<std::mutex> lock{external_dictionaries.dictionaries_mutex};

View File

@ -40,13 +40,13 @@ BlockInputStreams StorageSystemEvents::read(
Block block;
ColumnWithNameAndType col_event;
ColumnWithTypeAndName col_event;
col_event.name = "event";
col_event.type = new DataTypeString;
col_event.column = new ColumnString;
block.insert(col_event);
ColumnWithNameAndType col_value;
ColumnWithTypeAndName col_value;
col_value.name = "value";
col_value.type = new DataTypeUInt64;
col_value.column = new ColumnUInt64;

View File

@ -36,8 +36,8 @@ BlockInputStreams StorageSystemFunctions::read(
check(column_names);
processed_stage = QueryProcessingStage::FetchColumns;
ColumnWithNameAndType column_name{ new ColumnString, new DataTypeString, "name" };
ColumnWithNameAndType column_is_aggregate{ new ColumnUInt8, new DataTypeUInt8, "is_aggregate" };
ColumnWithTypeAndName column_name{ new ColumnString, new DataTypeString, "name" };
ColumnWithTypeAndName column_is_aggregate{ new ColumnUInt8, new DataTypeUInt8, "is_aggregate" };
const auto & functions = FunctionFactory::instance().functions;
for (const auto & it : functions)

View File

@ -46,18 +46,18 @@ BlockInputStreams StorageSystemMerges::read(
check(column_names);
processed_stage = QueryProcessingStage::FetchColumns;
ColumnWithNameAndType col_database{new ColumnString, new DataTypeString, "database"};
ColumnWithNameAndType col_table{new ColumnString, new DataTypeString, "table"};
ColumnWithNameAndType col_elapsed{new ColumnFloat64, new DataTypeFloat64, "elapsed"};
ColumnWithNameAndType col_progress{new ColumnFloat64, new DataTypeFloat64, "progress"};
ColumnWithNameAndType col_num_parts{new ColumnUInt64, new DataTypeUInt64, "num_parts"};
ColumnWithNameAndType col_result_part_name{new ColumnString, new DataTypeString, "result_part_name"};
ColumnWithNameAndType col_total_size_bytes_compressed{new ColumnUInt64, new DataTypeUInt64, "total_size_bytes_compressed"};
ColumnWithNameAndType col_total_size_marks{new ColumnUInt64, new DataTypeUInt64, "total_size_marks"};
ColumnWithNameAndType col_bytes_read_uncompressed{new ColumnUInt64, new DataTypeUInt64, "bytes_read_uncompressed"};
ColumnWithNameAndType col_rows_read{new ColumnUInt64, new DataTypeUInt64, "rows_read"};
ColumnWithNameAndType col_bytes_written_uncompressed{new ColumnUInt64, new DataTypeUInt64, "bytes_written_uncompressed"};
ColumnWithNameAndType col_rows_written{new ColumnUInt64, new DataTypeUInt64, "rows_written"};
ColumnWithTypeAndName col_database{new ColumnString, new DataTypeString, "database"};
ColumnWithTypeAndName col_table{new ColumnString, new DataTypeString, "table"};
ColumnWithTypeAndName col_elapsed{new ColumnFloat64, new DataTypeFloat64, "elapsed"};
ColumnWithTypeAndName col_progress{new ColumnFloat64, new DataTypeFloat64, "progress"};
ColumnWithTypeAndName col_num_parts{new ColumnUInt64, new DataTypeUInt64, "num_parts"};
ColumnWithTypeAndName col_result_part_name{new ColumnString, new DataTypeString, "result_part_name"};
ColumnWithTypeAndName col_total_size_bytes_compressed{new ColumnUInt64, new DataTypeUInt64, "total_size_bytes_compressed"};
ColumnWithTypeAndName col_total_size_marks{new ColumnUInt64, new DataTypeUInt64, "total_size_marks"};
ColumnWithTypeAndName col_bytes_read_uncompressed{new ColumnUInt64, new DataTypeUInt64, "bytes_read_uncompressed"};
ColumnWithTypeAndName col_rows_read{new ColumnUInt64, new DataTypeUInt64, "rows_read"};
ColumnWithTypeAndName col_bytes_written_uncompressed{new ColumnUInt64, new DataTypeUInt64, "bytes_written_uncompressed"};
ColumnWithTypeAndName col_rows_written{new ColumnUInt64, new DataTypeUInt64, "rows_written"};
for (const auto & merge : context.getMergeList().get())
{

View File

@ -27,7 +27,7 @@ protected:
{
Block res;
ColumnWithNameAndType column_with_name_and_type;
ColumnWithTypeAndName column_with_name_and_type;
column_with_name_and_type.name = "number";
column_with_name_and_type.type = new DataTypeUInt64();

View File

@ -35,7 +35,7 @@ BlockInputStreams StorageSystemOne::read(
processed_stage = QueryProcessingStage::FetchColumns;
Block block;
ColumnWithNameAndType col;
ColumnWithTypeAndName col;
col.name = "dummy";
col.type = new DataTypeUInt8;
col.column = ColumnConstUInt8(1, 0).convertToFullColumn();

View File

@ -74,7 +74,7 @@ BlockInputStreams StorageSystemParts::read(
ColumnPtr database_column = new ColumnString;
for (const auto & database : databases)
database_column->insert(database.first);
block.insert(ColumnWithNameAndType(database_column, new DataTypeString, "database"));
block.insert(ColumnWithTypeAndName(database_column, new DataTypeString, "database"));
/// Отфильтруем блок со столбцом database.
VirtualColumnUtils::filterBlockWithQuery(query, block, context);
@ -137,10 +137,10 @@ BlockInputStreams StorageSystemParts::read(
column = column->replicate(offsets);
}
block.insert(ColumnWithNameAndType(table_column, new DataTypeString, "table"));
block.insert(ColumnWithNameAndType(engine_column, new DataTypeString, "engine"));
block.insert(ColumnWithNameAndType(replicated_column, new DataTypeUInt8, "replicated"));
block.insert(ColumnWithNameAndType(active_column, new DataTypeUInt8, "active"));
block.insert(ColumnWithTypeAndName(table_column, new DataTypeString, "table"));
block.insert(ColumnWithTypeAndName(engine_column, new DataTypeString, "engine"));
block.insert(ColumnWithTypeAndName(replicated_column, new DataTypeUInt8, "replicated"));
block.insert(ColumnWithTypeAndName(active_column, new DataTypeUInt8, "active"));
}
/// Отфильтруем блок со столбцами database, table, engine, replicated и active.
@ -252,23 +252,23 @@ BlockInputStreams StorageSystemParts::read(
block.clear();
block.insert(ColumnWithNameAndType(partition_column, new DataTypeString, "partition"));
block.insert(ColumnWithNameAndType(name_column, new DataTypeString, "name"));
block.insert(ColumnWithNameAndType(replicated_column, new DataTypeUInt8, "replicated"));
block.insert(ColumnWithNameAndType(active_column, new DataTypeUInt8, "active"));
block.insert(ColumnWithNameAndType(marks_column, new DataTypeUInt64, "marks"));
block.insert(ColumnWithNameAndType(bytes_column, new DataTypeUInt64, "bytes"));
block.insert(ColumnWithNameAndType(modification_time_column, new DataTypeDateTime, "modification_time"));
block.insert(ColumnWithNameAndType(remove_time_column, new DataTypeDateTime, "remove_time"));
block.insert(ColumnWithNameAndType(refcount_column, new DataTypeUInt32, "refcount"));
block.insert(ColumnWithNameAndType(min_date_column, new DataTypeDate, "min_date"));
block.insert(ColumnWithNameAndType(max_date_column, new DataTypeDate, "max_date"));
block.insert(ColumnWithNameAndType(min_block_number_column, new DataTypeUInt64, "min_block_number"));
block.insert(ColumnWithNameAndType(max_block_number_column, new DataTypeUInt64, "max_block_number"));
block.insert(ColumnWithNameAndType(level_column, new DataTypeUInt32, "level"));
block.insert(ColumnWithNameAndType(database_column, new DataTypeString, "database"));
block.insert(ColumnWithNameAndType(table_column, new DataTypeString, "table"));
block.insert(ColumnWithNameAndType(engine_column, new DataTypeString, "engine"));
block.insert(ColumnWithTypeAndName(partition_column, new DataTypeString, "partition"));
block.insert(ColumnWithTypeAndName(name_column, new DataTypeString, "name"));
block.insert(ColumnWithTypeAndName(replicated_column, new DataTypeUInt8, "replicated"));
block.insert(ColumnWithTypeAndName(active_column, new DataTypeUInt8, "active"));
block.insert(ColumnWithTypeAndName(marks_column, new DataTypeUInt64, "marks"));
block.insert(ColumnWithTypeAndName(bytes_column, new DataTypeUInt64, "bytes"));
block.insert(ColumnWithTypeAndName(modification_time_column, new DataTypeDateTime, "modification_time"));
block.insert(ColumnWithTypeAndName(remove_time_column, new DataTypeDateTime, "remove_time"));
block.insert(ColumnWithTypeAndName(refcount_column, new DataTypeUInt32, "refcount"));
block.insert(ColumnWithTypeAndName(min_date_column, new DataTypeDate, "min_date"));
block.insert(ColumnWithTypeAndName(max_date_column, new DataTypeDate, "max_date"));
block.insert(ColumnWithTypeAndName(min_block_number_column, new DataTypeUInt64, "min_block_number"));
block.insert(ColumnWithTypeAndName(max_block_number_column, new DataTypeUInt64, "max_block_number"));
block.insert(ColumnWithTypeAndName(level_column, new DataTypeUInt32, "level"));
block.insert(ColumnWithTypeAndName(database_column, new DataTypeString, "database"));
block.insert(ColumnWithTypeAndName(table_column, new DataTypeString, "table"));
block.insert(ColumnWithTypeAndName(engine_column, new DataTypeString, "engine"));
return BlockInputStreams(1, new OneBlockInputStream(block));
}

View File

@ -44,15 +44,15 @@ BlockInputStreams StorageSystemProcesses::read(
check(column_names);
processed_stage = QueryProcessingStage::FetchColumns;
ColumnWithNameAndType col_user{new ColumnString, new DataTypeString, "user"};
ColumnWithNameAndType col_address{new ColumnString, new DataTypeString, "address"};
ColumnWithNameAndType col_elapsed{new ColumnFloat64, new DataTypeFloat64, "elapsed"};
ColumnWithNameAndType col_rows_read{new ColumnUInt64, new DataTypeUInt64, "rows_read"};
ColumnWithNameAndType col_bytes_read{new ColumnUInt64, new DataTypeUInt64, "bytes_read"};
ColumnWithNameAndType col_total_rows_approx{new ColumnUInt64, new DataTypeUInt64, "total_rows_approx"};
ColumnWithNameAndType col_memory_usage{new ColumnUInt64, new DataTypeUInt64, "memory_usage"};
ColumnWithNameAndType col_query{new ColumnString, new DataTypeString, "query"};
ColumnWithNameAndType col_query_id{new ColumnString, new DataTypeString, "query_id"};
ColumnWithTypeAndName col_user{new ColumnString, new DataTypeString, "user"};
ColumnWithTypeAndName col_address{new ColumnString, new DataTypeString, "address"};
ColumnWithTypeAndName col_elapsed{new ColumnFloat64, new DataTypeFloat64, "elapsed"};
ColumnWithTypeAndName col_rows_read{new ColumnUInt64, new DataTypeUInt64, "rows_read"};
ColumnWithTypeAndName col_bytes_read{new ColumnUInt64, new DataTypeUInt64, "bytes_read"};
ColumnWithTypeAndName col_total_rows_approx{new ColumnUInt64, new DataTypeUInt64, "total_rows_approx"};
ColumnWithTypeAndName col_memory_usage{new ColumnUInt64, new DataTypeUInt64, "memory_usage"};
ColumnWithTypeAndName col_query{new ColumnString, new DataTypeString, "query"};
ColumnWithTypeAndName col_query_id{new ColumnString, new DataTypeString, "query_id"};
for (const auto & process : context.getProcessList().get())
{

View File

@ -84,9 +84,9 @@ BlockInputStreams StorageSystemReplicas::read(
}
}
ColumnWithNameAndType col_database { new ColumnString, new DataTypeString, "database"};
ColumnWithNameAndType col_table { new ColumnString, new DataTypeString, "table"};
ColumnWithNameAndType col_engine { new ColumnString, new DataTypeString, "engine"};
ColumnWithTypeAndName col_database { new ColumnString, new DataTypeString, "database"};
ColumnWithTypeAndName col_table { new ColumnString, new DataTypeString, "table"};
ColumnWithTypeAndName col_engine { new ColumnString, new DataTypeString, "engine"};
for (auto & db : replicated_tables)
{
@ -112,25 +112,25 @@ BlockInputStreams StorageSystemReplicas::read(
col_engine = filtered_block.getByName("engine");
}
ColumnWithNameAndType col_is_leader { new ColumnUInt8, new DataTypeUInt8, "is_leader"};
ColumnWithNameAndType col_is_readonly { new ColumnUInt8, new DataTypeUInt8, "is_readonly"};
ColumnWithNameAndType col_is_session_expired{ new ColumnUInt8, new DataTypeUInt8, "is_session_expired"};
ColumnWithNameAndType col_future_parts { new ColumnUInt32, new DataTypeUInt32, "future_parts"};
ColumnWithNameAndType col_parts_to_check { new ColumnUInt32, new DataTypeUInt32, "parts_to_check"};
ColumnWithNameAndType col_zookeeper_path { new ColumnString, new DataTypeString, "zookeeper_path"};
ColumnWithNameAndType col_replica_name { new ColumnString, new DataTypeString, "replica_name"};
ColumnWithNameAndType col_replica_path { new ColumnString, new DataTypeString, "replica_path"};
ColumnWithNameAndType col_columns_version { new ColumnInt32, new DataTypeInt32, "columns_version"};
ColumnWithNameAndType col_queue_size { new ColumnUInt32, new DataTypeUInt32, "queue_size"};
ColumnWithNameAndType col_inserts_in_queue { new ColumnUInt32, new DataTypeUInt32, "inserts_in_queue"};
ColumnWithNameAndType col_merges_in_queue { new ColumnUInt32, new DataTypeUInt32, "merges_in_queue"};
ColumnWithNameAndType col_queue_oldest_time { new ColumnUInt32, new DataTypeDateTime, "queue_oldest_time"};
ColumnWithNameAndType col_inserts_oldest_time{ new ColumnUInt32,new DataTypeDateTime, "inserts_oldest_time"};
ColumnWithNameAndType col_merges_oldest_time{ new ColumnUInt32, new DataTypeDateTime, "merges_oldest_time"};
ColumnWithNameAndType col_log_max_index { new ColumnUInt64, new DataTypeUInt64, "log_max_index"};
ColumnWithNameAndType col_log_pointer { new ColumnUInt64, new DataTypeUInt64, "log_pointer"};
ColumnWithNameAndType col_total_replicas { new ColumnUInt8, new DataTypeUInt8, "total_replicas"};
ColumnWithNameAndType col_active_replicas { new ColumnUInt8, new DataTypeUInt8, "active_replicas"};
ColumnWithTypeAndName col_is_leader { new ColumnUInt8, new DataTypeUInt8, "is_leader"};
ColumnWithTypeAndName col_is_readonly { new ColumnUInt8, new DataTypeUInt8, "is_readonly"};
ColumnWithTypeAndName col_is_session_expired{ new ColumnUInt8, new DataTypeUInt8, "is_session_expired"};
ColumnWithTypeAndName col_future_parts { new ColumnUInt32, new DataTypeUInt32, "future_parts"};
ColumnWithTypeAndName col_parts_to_check { new ColumnUInt32, new DataTypeUInt32, "parts_to_check"};
ColumnWithTypeAndName col_zookeeper_path { new ColumnString, new DataTypeString, "zookeeper_path"};
ColumnWithTypeAndName col_replica_name { new ColumnString, new DataTypeString, "replica_name"};
ColumnWithTypeAndName col_replica_path { new ColumnString, new DataTypeString, "replica_path"};
ColumnWithTypeAndName col_columns_version { new ColumnInt32, new DataTypeInt32, "columns_version"};
ColumnWithTypeAndName col_queue_size { new ColumnUInt32, new DataTypeUInt32, "queue_size"};
ColumnWithTypeAndName col_inserts_in_queue { new ColumnUInt32, new DataTypeUInt32, "inserts_in_queue"};
ColumnWithTypeAndName col_merges_in_queue { new ColumnUInt32, new DataTypeUInt32, "merges_in_queue"};
ColumnWithTypeAndName col_queue_oldest_time { new ColumnUInt32, new DataTypeDateTime, "queue_oldest_time"};
ColumnWithTypeAndName col_inserts_oldest_time{ new ColumnUInt32,new DataTypeDateTime, "inserts_oldest_time"};
ColumnWithTypeAndName col_merges_oldest_time{ new ColumnUInt32, new DataTypeDateTime, "merges_oldest_time"};
ColumnWithTypeAndName col_log_max_index { new ColumnUInt64, new DataTypeUInt64, "log_max_index"};
ColumnWithTypeAndName col_log_pointer { new ColumnUInt64, new DataTypeUInt64, "log_pointer"};
ColumnWithTypeAndName col_total_replicas { new ColumnUInt8, new DataTypeUInt8, "total_replicas"};
ColumnWithTypeAndName col_active_replicas { new ColumnUInt8, new DataTypeUInt8, "active_replicas"};
for (size_t i = 0, size = col_database.column->size(); i < size; ++i)
{

View File

@ -37,9 +37,9 @@ BlockInputStreams StorageSystemSettings::read(
check(column_names);
processed_stage = QueryProcessingStage::FetchColumns;
ColumnWithNameAndType col_name{new ColumnString, new DataTypeString, "name"};
ColumnWithNameAndType col_value{new ColumnString, new DataTypeString, "value"};
ColumnWithNameAndType col_changed{new ColumnUInt8, new DataTypeUInt8, "changed"};
ColumnWithTypeAndName col_name{new ColumnString, new DataTypeString, "name"};
ColumnWithTypeAndName col_value{new ColumnString, new DataTypeString, "value"};
ColumnWithTypeAndName col_changed{new ColumnUInt8, new DataTypeUInt8, "changed"};
#define ADD_SETTING(TYPE, NAME, DEFAULT) \
col_name.column->insert(String(#NAME)); \

View File

@ -26,9 +26,9 @@ StoragePtr StorageSystemTables::create(const std::string & name_)
}
static ColumnWithNameAndType getFilteredDatabases(ASTPtr query, const Context & context)
static ColumnWithTypeAndName getFilteredDatabases(ASTPtr query, const Context & context)
{
ColumnWithNameAndType column;
ColumnWithTypeAndName column;
column.name = "database";
column.type = new DataTypeString;
column.column = new ColumnString;
@ -58,19 +58,19 @@ BlockInputStreams StorageSystemTables::read(
Block block;
ColumnWithNameAndType col_db;
ColumnWithTypeAndName col_db;
col_db.name = "database";
col_db.type = new DataTypeString;
col_db.column = new ColumnString;
block.insert(col_db);
ColumnWithNameAndType col_name;
ColumnWithTypeAndName col_name;
col_name.name = "name";
col_name.type = new DataTypeString;
col_name.column = new ColumnString;
block.insert(col_name);
ColumnWithNameAndType col_engine;
ColumnWithTypeAndName col_engine;
col_engine.name = "engine";
col_engine.type = new DataTypeString;
col_engine.column = new ColumnString;
@ -78,7 +78,7 @@ BlockInputStreams StorageSystemTables::read(
Poco::ScopedLock<Poco::Mutex> lock(context.getMutex());
ColumnWithNameAndType filtered_databases_column = getFilteredDatabases(query, context);
ColumnWithTypeAndName filtered_databases_column = getFilteredDatabases(query, context);
for (size_t row_number = 0; row_number < filtered_databases_column.column->size(); ++row_number)
{

View File

@ -119,20 +119,20 @@ BlockInputStreams StorageSystemZooKeeper::read(
if (path.empty())
throw Exception("SELECT from system.zookeeper table must contain condition like path = 'path' in WHERE clause.");
ColumnWithNameAndType col_name { new ColumnString, new DataTypeString, "name" };
ColumnWithNameAndType col_value { new ColumnString, new DataTypeString, "value" };
ColumnWithNameAndType col_czxid { new ColumnInt64, new DataTypeInt64, "czxid" };
ColumnWithNameAndType col_mzxid { new ColumnInt64, new DataTypeInt64, "mzxid" };
ColumnWithNameAndType col_ctime { new ColumnUInt32, new DataTypeDateTime, "ctime" };
ColumnWithNameAndType col_mtime { new ColumnUInt32, new DataTypeDateTime, "mtime" };
ColumnWithNameAndType col_version { new ColumnInt32, new DataTypeInt32, "version" };
ColumnWithNameAndType col_cversion { new ColumnInt32, new DataTypeInt32, "cversion" };
ColumnWithNameAndType col_aversion { new ColumnInt32, new DataTypeInt32, "aversion" };
ColumnWithNameAndType col_ephemeralOwner{ new ColumnInt64, new DataTypeInt64, "ephemeralOwner" };
ColumnWithNameAndType col_dataLength { new ColumnInt32, new DataTypeInt32, "dataLength" };
ColumnWithNameAndType col_numChildren { new ColumnInt32, new DataTypeInt32, "numChildren" };
ColumnWithNameAndType col_pzxid { new ColumnInt64, new DataTypeInt64, "pzxid" };
ColumnWithNameAndType col_path { new ColumnString, new DataTypeString, "path" };
ColumnWithTypeAndName col_name { new ColumnString, new DataTypeString, "name" };
ColumnWithTypeAndName col_value { new ColumnString, new DataTypeString, "value" };
ColumnWithTypeAndName col_czxid { new ColumnInt64, new DataTypeInt64, "czxid" };
ColumnWithTypeAndName col_mzxid { new ColumnInt64, new DataTypeInt64, "mzxid" };
ColumnWithTypeAndName col_ctime { new ColumnUInt32, new DataTypeDateTime, "ctime" };
ColumnWithTypeAndName col_mtime { new ColumnUInt32, new DataTypeDateTime, "mtime" };
ColumnWithTypeAndName col_version { new ColumnInt32, new DataTypeInt32, "version" };
ColumnWithTypeAndName col_cversion { new ColumnInt32, new DataTypeInt32, "cversion" };
ColumnWithTypeAndName col_aversion { new ColumnInt32, new DataTypeInt32, "aversion" };
ColumnWithTypeAndName col_ephemeralOwner{ new ColumnInt64, new DataTypeInt64, "ephemeralOwner" };
ColumnWithTypeAndName col_dataLength { new ColumnInt32, new DataTypeInt32, "dataLength" };
ColumnWithTypeAndName col_numChildren { new ColumnInt32, new DataTypeInt32, "numChildren" };
ColumnWithTypeAndName col_pzxid { new ColumnInt64, new DataTypeInt64, "pzxid" };
ColumnWithTypeAndName col_path { new ColumnString, new DataTypeString, "path" };
zkutil::ZooKeeperPtr zookeeper = context.getZooKeeper();

View File

@ -177,7 +177,7 @@ Block TinyLogBlockInputStream::readImpl()
for (Names::const_iterator it = column_names.begin(); it != column_names.end(); ++it)
{
ColumnWithNameAndType column;
ColumnWithTypeAndName column;
column.name = *it;
column.type = storage.getDataTypeByName(*it);
@ -334,7 +334,7 @@ void TinyLogBlockOutputStream::write(const Block & block)
for (size_t i = 0; i < block.columns(); ++i)
{
const ColumnWithNameAndType & column = block.getByPosition(i);
const ColumnWithTypeAndName & column = block.getByPosition(i);
writeData(column.name, *column.type, *column.column, offset_columns);
}
}

View File

@ -109,7 +109,7 @@ int main(int argc, char ** argv)
Block sample;
for (NamesAndTypesList::const_iterator it = names_and_types_list->begin(); it != names_and_types_list->end(); ++it)
{
ColumnWithNameAndType elem;
ColumnWithTypeAndName elem;
elem.name = it->name;
elem.type = it->type;
elem.column = elem.type->createColumn();

View File

@ -53,7 +53,7 @@ int main(int argc, char ** argv)
{
Block block;
ColumnWithNameAndType column1;
ColumnWithTypeAndName column1;
column1.name = "d";
column1.type = table->getDataTypeByName("d");
column1.column = column1.type->createColumn();
@ -65,7 +65,7 @@ int main(int argc, char ** argv)
block.insert(column1);
ColumnWithNameAndType column2;
ColumnWithTypeAndName column2;
column2.name = "a";
column2.type = table->getDataTypeByName("a");
column2.column = column2.type->createColumn();
@ -101,12 +101,12 @@ int main(int argc, char ** argv)
Block sample;
{
ColumnWithNameAndType col;
ColumnWithTypeAndName col;
col.type = names_and_types->front().type;
sample.insert(col);
}
{
ColumnWithNameAndType col;
ColumnWithTypeAndName col;
col.type = names_and_types->back().type;
sample.insert(col);
}

View File

@ -33,7 +33,7 @@ int main(int argc, char ** argv)
{
DB::Block block;
DB::ColumnWithNameAndType column1;
DB::ColumnWithTypeAndName column1;
column1.name = "a";
column1.type = table->getDataTypeByName("a");
column1.column = column1.type->createColumn();
@ -45,7 +45,7 @@ int main(int argc, char ** argv)
block.insert(column1);
DB::ColumnWithNameAndType column2;
DB::ColumnWithTypeAndName column2;
column2.name = "b";
column2.type = table->getDataTypeByName("b");
column2.column = column2.type->createColumn();
@ -73,12 +73,12 @@ int main(int argc, char ** argv)
DB::Block sample;
{
DB::ColumnWithNameAndType col;
DB::ColumnWithTypeAndName col;
col.type = new DB::DataTypeUInt64;
sample.insert(col);
}
{
DB::ColumnWithNameAndType col;
DB::ColumnWithTypeAndName col;
col.type = new DB::DataTypeUInt8;
sample.insert(col);
}

View File

@ -24,7 +24,7 @@ int main(int argc, char ** argv)
column_names.push_back("number");
DB::Block sample;
DB::ColumnWithNameAndType col;
DB::ColumnWithTypeAndName col;
col.type = new DB::DataTypeUInt64;
sample.insert(col);