ClickHouse/dbms/src/Storages/StorageSystemOne.cpp

52 lines
936 B
C++
Raw Normal View History

2011-08-28 02:22:23 +00:00
#include <DB/Core/Exception.h>
#include <DB/Core/ErrorCodes.h>
#include <DB/Columns/ColumnsNumber.h>
#include <DB/DataTypes/DataTypesNumberFixed.h>
#include <DB/Storages/StorageSystemOne.h>
namespace DB
{
OneValueBlockInputStream::OneValueBlockInputStream() : has_been_read(false)
{
}
2011-09-04 21:23:19 +00:00
Block OneValueBlockInputStream::readImpl()
2011-08-28 02:22:23 +00:00
{
Block res;
if (has_been_read)
return res;
has_been_read = true;
ColumnWithNameAndType col;
col.name = "dummy";
col.type = new DataTypeUInt8;
2011-08-28 08:02:11 +00:00
col.column = new ColumnConstUInt8(1, 0);
2011-08-28 02:22:23 +00:00
res.insert(col);
return res;
}
StorageSystemOne::StorageSystemOne(const std::string & name_)
: name(name_)
{
2011-11-01 17:12:11 +00:00
columns.push_back(NameAndTypePair("dummy", new DataTypeUInt8));
2011-08-28 02:22:23 +00:00
}
2012-01-09 19:20:48 +00:00
BlockInputStreams StorageSystemOne::read(
const Names & column_names, ASTPtr query, size_t max_block_size, unsigned max_threads)
2011-08-28 02:22:23 +00:00
{
check(column_names);
2012-01-09 19:20:48 +00:00
return BlockInputStreams(1, new OneValueBlockInputStream());
2011-08-28 02:22:23 +00:00
}
}