ClickHouse/src/Storages/StorageMaterializeMySQL.h

51 lines
1.4 KiB
C++
Raw Normal View History

#pragma once
#include "config_core.h"
#if USE_MYSQL
#include <Storages/StorageProxy.h>
namespace DB
{
namespace ErrorCodes
{
extern const int NOT_IMPLEMENTED;
}
class StorageMaterializeMySQL final : public ext::shared_ptr_helper<StorageMaterializeMySQL>, public StorageProxy
{
2020-09-15 13:30:30 +00:00
friend struct ext::shared_ptr_helper<StorageMaterializeMySQL>;
public:
String getName() const override { return "MaterializeMySQL"; }
2020-09-15 13:30:30 +00:00
StorageMaterializeMySQL(const StoragePtr & nested_storage_, const IDatabase * database_);
2020-08-14 05:28:26 +00:00
Pipe read(
const Names & column_names, const StorageMetadataPtr & metadata_snapshot, SelectQueryInfo & query_info,
const Context & context, QueryProcessingStage::Enum processed_stage, size_t max_block_size, unsigned num_streams) override;
BlockOutputStreamPtr write(const ASTPtr &, const StorageMetadataPtr &, const Context &) override { throwNotAllowed(); }
2020-06-24 05:28:27 +00:00
NamesAndTypesList getVirtuals() const override;
ColumnSizeByName getColumnSizes() const override;
2020-06-24 05:28:27 +00:00
StoragePtr getNested() const override { return nested_storage; }
void drop() override { nested_storage->drop(); }
private:
[[noreturn]] void throwNotAllowed() const
{
throw Exception("This method is not allowed for MaterializeMySQL", ErrorCodes::NOT_IMPLEMENTED);
}
StoragePtr nested_storage;
2020-09-15 13:30:30 +00:00
const IDatabase * database;
};
}
#endif