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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
#pragma once
#include <Processors/QueryPlan/SourceStepWithFilter.h>
#include <Storages/SelectQueryInfo.h>
#include <Storages/IStorage.h>
namespace DB
{
class StorageDummy : public IStorage
{
public:
StorageDummy(const StorageID & table_id_, const ColumnsDescription & columns_, ColumnsDescription object_columns_ = {});
std::string getName() const override { return "StorageDummy"; }
bool supportsSampling() const override { return true; }
bool supportsFinal() const override { return true; }
bool supportsPrewhere() const override { return true; }
bool supportsSubcolumns() const override { return true; }
bool supportsDynamicSubcolumns() const override { return true; }
bool canMoveConditionsToPrewhere() const override { return false; }
StorageSnapshotPtr getStorageSnapshot(const StorageMetadataPtr & metadata_snapshot, ContextPtr /*query_context*/) const override
{
return std::make_shared<StorageSnapshot>(*this, metadata_snapshot, object_columns);
}
QueryProcessingStage::Enum getQueryProcessingStage(
ContextPtr local_context,
QueryProcessingStage::Enum to_stage,
const StorageSnapshotPtr & storage_snapshot,
SelectQueryInfo & query_info) const override;
void read(
QueryPlan & query_plan,
const Names & column_names,
const StorageSnapshotPtr & storage_snapshot,
SelectQueryInfo & query_info,
ContextPtr local_context,
QueryProcessingStage::Enum processed_stage,
size_t max_block_size,
size_t num_streams) override;
private:
const ColumnsDescription object_columns;
};
class ReadFromDummy : public SourceStepWithFilter
{
public:
explicit ReadFromDummy(const StorageDummy & storage_,
StorageSnapshotPtr storage_snapshot_,
Names column_names_);
const StorageDummy & getStorage() const
{
return storage;
}
const StorageSnapshotPtr & getStorageSnapshot() const
{
return storage_snapshot;
}
const Names & getColumnNames() const
{
return column_names;
}
String getName() const override { return "ReadFromDummy"; }
void initializePipeline(QueryPipelineBuilder & pipeline, const BuildQueryPipelineSettings & settings) override;
private:
const StorageDummy & storage;
StorageSnapshotPtr storage_snapshot;
Names column_names;
};
}
|