2023-01-09 12:30:32 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Storages/IStorage.h>
|
|
|
|
#include <Interpreters/Cluster.h>
|
|
|
|
#include <QueryPipeline/RemoteQueryExecutor.h>
|
2023-05-12 13:58:45 +00:00
|
|
|
#include <Parsers/ASTExpressionList.h>
|
2023-01-09 12:30:32 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
2024-01-02 17:14:16 +00:00
|
|
|
void read(
|
|
|
|
QueryPlan & query_plan,
|
2023-05-12 13:58:45 +00:00
|
|
|
const Names & column_names,
|
|
|
|
const StorageSnapshotPtr & storage_snapshot,
|
|
|
|
SelectQueryInfo & query_info,
|
|
|
|
ContextPtr context,
|
|
|
|
QueryProcessingStage::Enum processed_stage,
|
|
|
|
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)
|
2024-01-02 17:14:16 +00:00
|
|
|
virtual RemoteQueryExecutor::Extension getTaskIteratorExtension(const ActionsDAG::Node * predicate, const ContextPtr & context) const = 0;
|
2023-01-09 12:30:32 +00:00
|
|
|
|
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-05-12 13:58:45 +00:00
|
|
|
virtual void addColumnsStructureToQuery(ASTPtr & query, const String & structure, const ContextPtr & context) = 0;
|
2023-04-24 13:20:04 +00:00
|
|
|
|
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
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}
|