ClickHouse/src/Storages/StorageDummy.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

82 lines
2.3 KiB
C++
Raw Normal View History

2023-02-24 12:46:09 +00:00
#pragma once
#include <Processors/QueryPlan/SourceStepWithFilter.h>
#include <Storages/SelectQueryInfo.h>
#include <Storages/IStorage.h>
namespace DB
{
class StorageDummy : public IStorage
2023-02-24 12:46:09 +00:00
{
public:
StorageDummy(const StorageID & table_id_, const ColumnsDescription & columns_, ColumnsDescription object_columns_ = {});
2023-02-24 12:46:09 +00:00
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);
}
2023-02-24 12:46:09 +00:00
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;
2023-02-24 12:46:09 +00:00
};
class ReadFromDummy : public SourceStepWithFilter
2023-02-24 12:46:09 +00:00
{
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;
};
}