2023-01-09 12:30:32 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Storages/IStorage.h>
|
|
|
|
#include <Interpreters/Cluster.h>
|
|
|
|
#include <QueryPipeline/RemoteQueryExecutor.h>
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Base cluster for Storages used in table functions like s3Cluster and hdfsCluster
|
|
|
|
* Needed for code simplification around parallel_distributed_insert_select
|
|
|
|
*/
|
|
|
|
class IStorageCluster : public IStorage
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
explicit IStorageCluster(const StorageID & table_id_) : IStorage(table_id_) {}
|
|
|
|
|
|
|
|
virtual ClusterPtr getCluster(ContextPtr context) const = 0;
|
|
|
|
/// Query is needed for pruning by virtual columns (_file, _path)
|
|
|
|
virtual RemoteQueryExecutor::Extension getTaskIteratorExtension(ASTPtr query, ContextPtr context) const = 0;
|
|
|
|
|
|
|
|
bool isRemote() const override { return true; }
|
2023-02-23 09:05:51 +00:00
|
|
|
|
|
|
|
static ContextPtr updateSettingsForTableFunctionCluster(ContextPtr context, const Settings & settings)
|
|
|
|
{
|
|
|
|
Settings new_settings = settings;
|
|
|
|
|
|
|
|
/// Cluster table functions should always skip unavailable shards.
|
|
|
|
new_settings.skip_unavailable_shards = true;
|
|
|
|
|
|
|
|
auto new_context = Context::createCopy(context);
|
|
|
|
new_context->setSettings(new_settings);
|
|
|
|
return new_context;
|
|
|
|
}
|
2023-01-09 12:30:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}
|