2013-11-08 17:43:03 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <DB/Storages/StorageView.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
class StorageMaterializedView : public StorageView {
|
|
|
|
|
|
|
|
public:
|
|
|
|
static StoragePtr create(const String & table_name_, const String & database_name_,
|
|
|
|
Context & context_, ASTPtr & query_, NamesAndTypesListPtr columns_, bool attach_);
|
|
|
|
|
|
|
|
std::string getName() const { return "MaterializedView"; }
|
2013-11-13 14:39:48 +00:00
|
|
|
std::string getInnerTableName() const { return ".inner." + table_name; }
|
2013-11-08 17:43:03 +00:00
|
|
|
|
2014-08-05 10:56:58 +00:00
|
|
|
NameAndTypePair getColumn(const String &column_name) const;
|
|
|
|
bool hasColumn(const String &column_name) const;
|
|
|
|
|
2013-11-08 17:43:03 +00:00
|
|
|
BlockOutputStreamPtr write(ASTPtr query);
|
2014-03-20 13:28:49 +00:00
|
|
|
void drop() override;
|
2013-11-08 17:43:03 +00:00
|
|
|
bool optimize();
|
|
|
|
|
|
|
|
BlockInputStreams read(
|
|
|
|
const Names & column_names,
|
|
|
|
ASTPtr query,
|
|
|
|
const Settings & settings,
|
|
|
|
QueryProcessingStage::Enum & processed_stage,
|
|
|
|
size_t max_block_size = DEFAULT_BLOCK_SIZE,
|
|
|
|
unsigned threads = 1);
|
|
|
|
|
|
|
|
private:
|
|
|
|
StoragePtr data;
|
|
|
|
|
|
|
|
StorageMaterializedView(const String & table_name_, const String & database_name_,
|
|
|
|
Context & context_, ASTPtr & query_, NamesAndTypesListPtr columns_, bool attach_);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|