ClickHouse/src/Storages/StorageValues.cpp

41 lines
1021 B
C++
Raw Normal View History

2019-07-29 13:50:13 +00:00
#include <Storages/IStorage.h>
2019-08-01 01:53:38 +00:00
#include <Storages/ColumnsDescription.h>
2019-07-29 13:50:13 +00:00
#include <Storages/StorageValues.h>
#include <DataStreams/OneBlockInputStream.h>
#include <Processors/Sources/SourceFromSingleChunk.h>
#include <Processors/Pipe.h>
2019-07-29 13:50:13 +00:00
2019-07-30 12:15:02 +00:00
2019-07-29 13:50:13 +00:00
namespace DB
{
2019-07-31 14:12:05 +00:00
2020-04-29 12:15:23 +00:00
StorageValues::StorageValues(
const StorageID & table_id_,
const ColumnsDescription & columns_,
const Block & res_block_,
const NamesAndTypesList & virtuals_)
: IStorage(table_id_), res_block(res_block_), virtuals(virtuals_)
2019-07-30 22:06:48 +00:00
{
2019-08-03 11:02:40 +00:00
setColumns(columns_);
2019-07-30 22:06:48 +00:00
}
2019-07-29 13:50:13 +00:00
Pipes StorageValues::read(
2019-07-29 16:20:17 +00:00
const Names & column_names,
const SelectQueryInfo & /*query_info*/,
const Context & /*context*/,
QueryProcessingStage::Enum /*processed_stage*/,
size_t /*max_block_size*/,
unsigned /*num_streams*/)
2019-07-29 13:50:13 +00:00
{
check(column_names, true);
2019-07-29 13:50:13 +00:00
Pipes pipes;
Chunk chunk(res_block.getColumns(), res_block.rows());
pipes.emplace_back(std::make_shared<SourceFromSingleChunk>(res_block.cloneEmpty(), std::move(chunk)));
return pipes;
2019-07-29 13:50:13 +00:00
}
2019-07-30 12:15:02 +00:00
2019-07-29 16:20:17 +00:00
}