2020-06-12 04:21:43 +00:00
|
|
|
#pragma once
|
|
|
|
|
2021-02-01 09:32:36 +00:00
|
|
|
#if !defined(ARCADIA_BUILD)
|
2020-08-07 16:14:10 +00:00
|
|
|
#include "config_core.h"
|
2021-02-01 09:32:36 +00:00
|
|
|
#endif
|
2020-08-07 16:14:10 +00:00
|
|
|
|
|
|
|
#if USE_MYSQL
|
|
|
|
|
2020-10-14 12:19:29 +00:00
|
|
|
#include <Storages/StorageProxy.h>
|
2020-06-12 04:21:43 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2020-10-14 12:19:29 +00:00
|
|
|
namespace ErrorCodes
|
|
|
|
{
|
|
|
|
extern const int NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2021-06-15 19:55:21 +00:00
|
|
|
class StorageMaterializeMySQL final : public shared_ptr_helper<StorageMaterializeMySQL>, public StorageProxy
|
2020-06-12 04:21:43 +00:00
|
|
|
{
|
2021-06-15 19:55:21 +00:00
|
|
|
friend struct shared_ptr_helper<StorageMaterializeMySQL>;
|
2020-06-12 04:21:43 +00:00
|
|
|
public:
|
2020-08-06 11:56:49 +00:00
|
|
|
String getName() const override { return "MaterializeMySQL"; }
|
2020-06-12 04:21:43 +00:00
|
|
|
|
2020-09-15 13:30:30 +00:00
|
|
|
StorageMaterializeMySQL(const StoragePtr & nested_storage_, const IDatabase * database_);
|
2020-06-12 04:21:43 +00:00
|
|
|
|
2020-08-14 05:28:26 +00:00
|
|
|
Pipe read(
|
2020-09-20 17:52:17 +00:00
|
|
|
const Names & column_names, const StorageMetadataPtr & metadata_snapshot, SelectQueryInfo & query_info,
|
2021-04-10 23:33:54 +00:00
|
|
|
ContextPtr context, QueryProcessingStage::Enum processed_stage, size_t max_block_size, unsigned num_streams) override;
|
2020-06-12 04:21:43 +00:00
|
|
|
|
2021-04-10 23:33:54 +00:00
|
|
|
BlockOutputStreamPtr write(const ASTPtr &, const StorageMetadataPtr &, ContextPtr) override { throwNotAllowed(); }
|
2020-10-14 12:19:29 +00:00
|
|
|
|
2020-06-24 05:28:27 +00:00
|
|
|
NamesAndTypesList getVirtuals() const override;
|
2020-10-08 20:39:24 +00:00
|
|
|
ColumnSizeByName getColumnSizes() const override;
|
2020-06-24 05:28:27 +00:00
|
|
|
|
2020-10-14 12:19:29 +00:00
|
|
|
StoragePtr getNested() const override { return nested_storage; }
|
2020-09-14 19:25:02 +00:00
|
|
|
|
|
|
|
void drop() override { nested_storage->drop(); }
|
|
|
|
|
2020-06-12 04:21:43 +00:00
|
|
|
private:
|
2020-10-14 12:19:29 +00:00
|
|
|
[[noreturn]] void throwNotAllowed() const
|
|
|
|
{
|
2020-11-09 09:45:41 +00:00
|
|
|
throw Exception("This method is not allowed for MaterializeMySQL", ErrorCodes::NOT_IMPLEMENTED);
|
2020-10-14 12:19:29 +00:00
|
|
|
}
|
|
|
|
|
2020-06-12 04:21:43 +00:00
|
|
|
StoragePtr nested_storage;
|
2020-09-15 13:30:30 +00:00
|
|
|
const IDatabase * database;
|
2020-06-12 04:21:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
2020-08-07 16:14:10 +00:00
|
|
|
|
|
|
|
#endif
|