2017-04-01 09:19:00 +00:00
|
|
|
#include <Columns/ColumnString.h>
|
|
|
|
#include <DataTypes/DataTypeString.h>
|
|
|
|
#include <DataTypes/DataTypesNumber.h>
|
|
|
|
#include <DataStreams/OneBlockInputStream.h>
|
|
|
|
#include <Interpreters/Settings.h>
|
|
|
|
#include <Storages/System/StorageSystemBuildOptions.h>
|
|
|
|
#include <Common/config_build.h>
|
2017-01-25 22:24:36 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
StorageSystemBuildOptions::StorageSystemBuildOptions(const std::string & name_)
|
2017-04-01 07:20:54 +00:00
|
|
|
: name(name_)
|
2017-06-18 06:11:49 +00:00
|
|
|
, columns
|
|
|
|
{
|
|
|
|
{ "name", std::make_shared<DataTypeString>() },
|
|
|
|
{ "value", std::make_shared<DataTypeString>() },
|
2017-04-01 07:20:54 +00:00
|
|
|
}
|
2017-01-25 22:24:36 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BlockInputStreams StorageSystemBuildOptions::read(
|
2017-04-01 07:20:54 +00:00
|
|
|
const Names & column_names,
|
2017-12-01 21:51:50 +00:00
|
|
|
const SelectQueryInfo &,
|
|
|
|
const Context &,
|
2017-04-01 07:20:54 +00:00
|
|
|
QueryProcessingStage::Enum & processed_stage,
|
2017-12-01 21:51:50 +00:00
|
|
|
const size_t /*max_block_size*/,
|
|
|
|
const unsigned /*num_streams*/)
|
2017-01-25 22:24:36 +00:00
|
|
|
{
|
2017-04-01 07:20:54 +00:00
|
|
|
check(column_names);
|
|
|
|
processed_stage = QueryProcessingStage::FetchColumns;
|
|
|
|
|
2017-12-14 01:43:19 +00:00
|
|
|
ColumnWithTypeAndName col_name{ColumnString::create(), std::make_shared<DataTypeString>(), "name"};
|
|
|
|
ColumnWithTypeAndName col_value{ColumnString::create(), std::make_shared<DataTypeString>(), "value"};
|
2017-04-01 07:20:54 +00:00
|
|
|
|
2017-06-18 06:11:49 +00:00
|
|
|
for (auto it = auto_config_build; *it; it += 2)
|
|
|
|
{
|
|
|
|
col_name.column->insert(String(it[0]));
|
|
|
|
col_value.column->insert(String(it[1]));
|
2017-04-01 07:20:54 +00:00
|
|
|
}
|
|
|
|
|
2017-06-18 06:11:49 +00:00
|
|
|
Block block
|
|
|
|
{
|
2017-04-01 07:20:54 +00:00
|
|
|
col_name,
|
|
|
|
col_value,
|
|
|
|
};
|
|
|
|
|
|
|
|
return BlockInputStreams(1, std::make_shared<OneBlockInputStream>(block));
|
2017-01-25 22:24:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|