ClickHouse/dbms/include/DB/Storages/StorageMerge.h
Alexey Milovidov 954ab221d6 Merge
2012-12-15 04:39:13 +00:00

50 lines
1.5 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#pragma once
#include <statdaemons/OptimizedRegularExpression.h>
#include <DB/Interpreters/Context.h>
#include <DB/Storages/IStorage.h>
namespace DB
{
/** Таблица, представляющая собой объединение произвольного количества других таблиц.
* У всех таблиц должна быть одинаковая структура.
*/
class StorageMerge : public IStorage
{
public:
StorageMerge(
const std::string & name_, /// Имя таблицы.
NamesAndTypesListPtr columns_, /// Список столбцов.
const String & source_database_, /// В какой БД искать таблицы-источники.
const String & table_name_regexp_, /// Регексп имён таблиц-источников.
Context & context_); /// Известные таблицы.
std::string getName() const { return "Merge"; }
std::string getTableName() const { return name; }
bool supportsSampling() const { return true; }
const NamesAndTypesList & getColumnsList() const { return *columns; }
BlockInputStreams read(
const Names & column_names,
ASTPtr query,
QueryProcessingStage::Enum & processed_stage,
size_t max_block_size = DEFAULT_BLOCK_SIZE,
unsigned threads = 1);
void drop() {}
void rename(const String & new_path_to_db, const String & new_name) { name = new_name; }
private:
String name;
NamesAndTypesListPtr columns;
String source_database;
OptimizedRegularExpression table_name_regexp;
Context context;
};
}