2017-01-25 22:24:36 +00:00
|
|
|
#include <DB/Columns/ColumnString.h>
|
|
|
|
#include <DB/DataTypes/DataTypeString.h>
|
2017-03-12 10:13:45 +00:00
|
|
|
#include <DB/DataTypes/DataTypesNumber.h>
|
2017-01-25 22:24:36 +00:00
|
|
|
#include <DB/DataStreams/OneBlockInputStream.h>
|
|
|
|
#include <DB/Interpreters/Settings.h>
|
|
|
|
#include <DB/Storages/System/StorageSystemBuildOptions.h>
|
2017-03-14 13:47:39 +00:00
|
|
|
#include <DB/Common/config_build.h>
|
2017-01-25 22:24:36 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
StorageSystemBuildOptions::StorageSystemBuildOptions(const std::string & name_)
|
|
|
|
: name(name_)
|
|
|
|
, columns{
|
|
|
|
{ "name", std::make_shared<DataTypeString>() },
|
|
|
|
{ "value", std::make_shared<DataTypeString>() },
|
|
|
|
}
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
StoragePtr StorageSystemBuildOptions::create(const std::string & name_)
|
|
|
|
{
|
|
|
|
return make_shared(name_);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BlockInputStreams StorageSystemBuildOptions::read(
|
|
|
|
const Names & column_names,
|
|
|
|
ASTPtr query,
|
|
|
|
const Context & context,
|
|
|
|
const Settings & settings,
|
|
|
|
QueryProcessingStage::Enum & processed_stage,
|
|
|
|
const size_t max_block_size,
|
|
|
|
const unsigned threads)
|
|
|
|
{
|
|
|
|
check(column_names);
|
|
|
|
processed_stage = QueryProcessingStage::FetchColumns;
|
|
|
|
|
|
|
|
ColumnWithTypeAndName col_name{std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "name"};
|
|
|
|
ColumnWithTypeAndName col_value{std::make_shared<ColumnString>(), std::make_shared<DataTypeString>(), "value"};
|
|
|
|
|
2017-01-31 18:03:56 +00:00
|
|
|
for (auto it = auto_config_build.begin(); it != auto_config_build.end(); ++it) {
|
|
|
|
col_name.column->insert(String(*it));
|
|
|
|
++it;
|
|
|
|
if (it == auto_config_build.end())
|
|
|
|
break;
|
|
|
|
col_value.column->insert(String(*it));
|
2017-01-25 22:24:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Block block{
|
|
|
|
col_name,
|
|
|
|
col_value,
|
|
|
|
};
|
|
|
|
|
|
|
|
return BlockInputStreams(1, std::make_shared<OneBlockInputStream>(block));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|