2020-06-12 04:21:43 +00:00
|
|
|
#pragma once
|
|
|
|
|
2022-09-28 13:29:29 +00:00
|
|
|
#include "config.h"
|
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;
|
|
|
|
}
|
|
|
|
|
2022-05-03 06:43:28 +00:00
|
|
|
class StorageMaterializedMySQL final : public StorageProxy
|
2020-06-12 04:21:43 +00:00
|
|
|
{
|
|
|
|
public:
|
2021-07-26 18:17:28 +00:00
|
|
|
StorageMaterializedMySQL(const StoragePtr & nested_storage_, const IDatabase * database_);
|
2020-06-12 04:21:43 +00:00
|
|
|
|
2022-04-19 20:47:29 +00:00
|
|
|
String getName() const override { return "MaterializedMySQL"; }
|
|
|
|
|
2021-07-05 19:07:56 +00:00
|
|
|
bool needRewriteQueryWithFinal(const Names & column_names) const override;
|
2021-06-28 10:35:55 +00:00
|
|
|
|
2022-05-20 19:49:31 +00:00
|
|
|
void read(
|
2022-10-07 10:46:45 +00:00
|
|
|
QueryPlan & query_plan,
|
|
|
|
const Names & column_names,
|
|
|
|
const StorageSnapshotPtr & metadata_snapshot,
|
|
|
|
SelectQueryInfo & query_info,
|
|
|
|
ContextPtr context,
|
|
|
|
QueryProcessingStage::Enum processed_stage,
|
|
|
|
size_t max_block_size, size_t num_streams) override;
|
2020-06-12 04:21:43 +00:00
|
|
|
|
2021-07-23 19:33:59 +00:00
|
|
|
SinkToStoragePtr 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:
|
2022-03-13 12:23:51 +00:00
|
|
|
[[noreturn]] static void throwNotAllowed()
|
2020-10-14 12:19:29 +00:00
|
|
|
{
|
2021-07-26 18:17:28 +00:00
|
|
|
throw Exception("This method is not allowed for MaterializedMySQL", 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
|