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
|
|
|
|
2023-06-07 18:33:08 +00:00
|
|
|
SinkToStoragePtr write(const ASTPtr &, const StorageMetadataPtr &, ContextPtr, bool) override { throwNotAllowed(); }
|
2020-10-14 12:19:29 +00:00
|
|
|
|
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(); }
|
|
|
|
|
2024-04-02 09:52:14 +00:00
|
|
|
bool supportsTrivialCountOptimization(const StorageSnapshotPtr &, ContextPtr) const override { return false; }
|
2023-06-23 08:44:13 +00:00
|
|
|
|
2023-08-14 08:30:29 +00:00
|
|
|
IndexSizeByName getSecondaryIndexSizes() const override
|
|
|
|
{
|
2023-08-13 21:57:41 +00:00
|
|
|
return nested_storage->getSecondaryIndexSizes();
|
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2023-01-23 21:13:58 +00:00
|
|
|
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "This method is not allowed for MaterializedMySQL");
|
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
|