aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Storages/StorageS3Cluster.h
blob: 55b7c08f4b0576048f35b569b588c4f3ffb635cb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#pragma once

#include "clickhouse_config.h"

#if USE_AWS_S3

#include <memory>
#include <optional>

#include "Client/Connection.h"
#include <Interpreters/Cluster.h>
#include <IO/S3Common.h>
#include <Storages/IStorageCluster.h>
#include <Storages/StorageS3.h>

namespace DB
{

class Context;

class StorageS3Cluster : public IStorageCluster
{
public:
    StorageS3Cluster(
        const String & cluster_name_,
        const StorageS3::Configuration & configuration_,
        const StorageID & table_id_,
        const ColumnsDescription & columns_,
        const ConstraintsDescription & constraints_,
        ContextPtr context_,
        bool structure_argument_was_provided_);

    std::string getName() const override { return "S3Cluster"; }

    NamesAndTypesList getVirtuals() const override;

    RemoteQueryExecutor::Extension getTaskIteratorExtension(ASTPtr query, const ContextPtr & context) const override;

    bool supportsSubcolumns() const override { return true; }

    bool supportsTrivialCountOptimization() const override { return true; }

protected:
    void updateConfigurationIfChanged(ContextPtr local_context);

private:
    void updateBeforeRead(const ContextPtr & context) override { updateConfigurationIfChanged(context); }

    void addColumnsStructureToQuery(ASTPtr & query, const String & structure, const ContextPtr & context) override;

    StorageS3::Configuration s3_configuration;
    NamesAndTypesList virtual_columns;
};


}

#endif