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:
|
2023-04-21 17:24:37 +00:00
|
|
|
IStorageCluster(
|
2023-04-24 13:20:04 +00:00
|
|
|
const String & cluster_name_,
|
2023-04-21 17:24:37 +00:00
|
|
|
const StorageID & table_id_,
|
|
|
|
Poco::Logger * log_,
|
|
|
|
bool structure_argument_was_provided_);
|
2023-01-09 12:30:32 +00:00
|
|
|
|
2023-04-21 17:24:37 +00:00
|
|
|
Pipe read(const Names &, const StorageSnapshotPtr &, SelectQueryInfo &,
|
|
|
|
ContextPtr, QueryProcessingStage::Enum, size_t /*max_block_size*/, size_t /*num_streams*/) override;
|
2023-01-09 12:30:32 +00:00
|
|
|
|
2023-04-21 17:24:37 +00:00
|
|
|
ClusterPtr getCluster(ContextPtr context) const;
|
2023-01-09 12:30:32 +00:00
|
|
|
/// Query is needed for pruning by virtual columns (_file, _path)
|
|
|
|
virtual RemoteQueryExecutor::Extension getTaskIteratorExtension(ASTPtr query, ContextPtr context) const = 0;
|
|
|
|
|
2023-04-21 17:24:37 +00:00
|
|
|
QueryProcessingStage::Enum getQueryProcessingStage(ContextPtr, QueryProcessingStage::Enum, const StorageSnapshotPtr &, SelectQueryInfo &) const override;
|
|
|
|
|
2023-01-09 12:30:32 +00:00
|
|
|
bool isRemote() const override { return true; }
|
2023-04-21 17:24:37 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void updateBeforeRead(const ContextPtr &) {}
|
|
|
|
|
2023-04-24 13:20:04 +00:00
|
|
|
virtual void addColumnsStructureToQuery(ASTPtr & query, const String & structure) = 0;
|
|
|
|
|
2023-04-21 17:24:37 +00:00
|
|
|
private:
|
|
|
|
Poco::Logger * log;
|
|
|
|
String cluster_name;
|
|
|
|
bool structure_argument_was_provided;
|
2023-01-09 12:30:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}
|