mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 10:02:01 +00:00
Cloud databases: development [#METR-19998].
This commit is contained in:
parent
5c2f335cc0
commit
86617c8339
71
dbms/include/DB/Storages/StorageCloud.h
Normal file
71
dbms/include/DB/Storages/StorageCloud.h
Normal file
@ -0,0 +1,71 @@
|
||||
#pragma once
|
||||
|
||||
#include <DB/Storages/IStorage.h>
|
||||
#include <DB/Databases/IDatabase.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
class DatabaseCloud;
|
||||
|
||||
|
||||
/** Таблица, представляющая собой объединение произвольного количества других таблиц.
|
||||
* У всех таблиц должна быть одинаковая структура.
|
||||
*/
|
||||
class StorageCloud : public IStorage
|
||||
{
|
||||
public:
|
||||
static StoragePtr create(
|
||||
const std::string & name_,
|
||||
NamesAndTypesListPtr columns_,
|
||||
const NamesAndTypesList & materialized_columns_,
|
||||
const NamesAndTypesList & alias_columns_,
|
||||
const ColumnDefaults & column_defaults_);
|
||||
|
||||
std::string getName() const override { return "Cloud"; }
|
||||
std::string getTableName() const override { return name; }
|
||||
|
||||
/// Проверка откладывается до метода read. Там проверяется поддержка PREWHERE у использующихся таблиц.
|
||||
bool supportsSampling() const override { return true; }
|
||||
bool supportsPrewhere() const override { return true; }
|
||||
bool supportsFinal() const override { return true; }
|
||||
bool supportsIndexForIn() const override { return true; }
|
||||
|
||||
const NamesAndTypesList & getColumnsListImpl() const override { return *columns; }
|
||||
NameAndTypePair getColumn(const String & column_name) const override;
|
||||
bool hasColumn(const String & column_name) const override;
|
||||
|
||||
BlockInputStreams read(
|
||||
const Names & column_names,
|
||||
ASTPtr query,
|
||||
const Context & context,
|
||||
const Settings & settings,
|
||||
QueryProcessingStage::Enum & processed_stage,
|
||||
size_t max_block_size = DEFAULT_BLOCK_SIZE,
|
||||
unsigned threads = 1) override;
|
||||
|
||||
void drop() override {}
|
||||
|
||||
void rename(const String & new_path_to_db, const String & new_database_name, const String & new_table_name) override
|
||||
{
|
||||
name = new_table_name;
|
||||
}
|
||||
|
||||
//void alter(const AlterCommands & params, const String & database_name, const String & table_name, const Context & context) override;
|
||||
|
||||
private:
|
||||
String name;
|
||||
NamesAndTypesListPtr columns;
|
||||
|
||||
std::weak_ptr<IDatabase> database;
|
||||
|
||||
StorageCloud(
|
||||
const std::string & name_,
|
||||
NamesAndTypesListPtr columns_,
|
||||
const NamesAndTypesList & materialized_columns_,
|
||||
const NamesAndTypesList & alias_columns_,
|
||||
const ColumnDefaults & column_defaults_);
|
||||
};
|
||||
|
||||
}
|
25
dbms/src/Storages/StorageCloud.cpp
Normal file
25
dbms/src/Storages/StorageCloud.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
#include <DB/Storages/StorageCloud.h>
|
||||
#include <DB/Databases/DatabaseCloud.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
namespace ErrorCodes
|
||||
{
|
||||
extern const int LOGICAL_ERROR;
|
||||
}
|
||||
|
||||
|
||||
void StorageCloud::drop()
|
||||
{
|
||||
DatabasePtr owned_db = database.lock();
|
||||
if (!owned_db)
|
||||
throw Exception("DatabaseCloud is detached", ErrorCodes::LOGICAL_ERROR);
|
||||
|
||||
DatabaseCloud & db = static_cast<DatabaseCloud &>(*owned_db);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user