dbms: more consistent usage of override in Storages [#METR-12524].

This commit is contained in:
Alexey Milovidov 2014-10-03 21:55:36 +04:00
parent defc09ed40
commit e84a0266e6
23 changed files with 161 additions and 151 deletions

View File

@ -606,20 +606,23 @@ public:
UInt64 getMaxDataPartIndex();
std::string getTableName() const {
throw Exception("Logical error: calling method getTableName of not a table.", ErrorCodes::LOGICAL_ERROR);
std::string getTableName() const
{
throw Exception("Logical error: calling method getTableName of not a table.", ErrorCodes::LOGICAL_ERROR);
}
const NamesAndTypesList & getColumnsList() const { return *columns; }
NameAndTypePair getColumn(const String &column_name) const
NameAndTypePair getColumn(const String & column_name) const
{
if (column_name == "_part") return NameAndTypePair("_part", new DataTypeString);
if (column_name == "_part_index") return NameAndTypePair("_part_index", new DataTypeUInt64);
if (column_name == "_part")
return NameAndTypePair("_part", new DataTypeString);
if (column_name == "_part_index")
return NameAndTypePair("_part_index", new DataTypeUInt64);
return getRealColumn(column_name);
}
bool hasColumn(const String &column_name) const
bool hasColumn(const String & column_name) const
{
if (column_name == "_part") return true;
if (column_name == "_part_index") return true;

View File

@ -27,12 +27,12 @@ public:
size_t chunks_to_merge_, /// Сколько чанков сливать в одну группу.
Context & context_); /// Известные таблицы.
std::string getName() const { return "ChunkMerger"; }
std::string getTableName() const { return name; }
std::string getName() const override { return "ChunkMerger"; }
std::string getTableName() const override { return name; }
const NamesAndTypesList & getColumnsList() const { return *columns; }
NameAndTypePair getColumn(const String &column_name) const;
bool hasColumn(const String &column_name) const;
const NamesAndTypesList & getColumnsList() const override { return *columns; }
NameAndTypePair getColumn(const String & column_name) const override;
bool hasColumn(const String & column_name) const override;
BlockInputStreams read(
const Names & column_names,
@ -40,13 +40,11 @@ public:
const Settings & settings,
QueryProcessingStage::Enum & processed_stage,
size_t max_block_size = DEFAULT_BLOCK_SIZE,
unsigned threads = 1);
unsigned threads = 1) override;
void shutdown();
void shutdown() override;
Block getBlockWithVirtualColumns(const Storages & selected_tables) const;
~StorageChunkMerger();
~StorageChunkMerger() override;
private:
String this_database;
@ -77,12 +75,14 @@ private:
const std::string & destination_name_prefix_,
size_t chunks_to_merge_,
Context & context_);
void mergeThread();
bool maybeMergeSomething();
Storages selectChunksToMerge();
bool mergeChunks(const Storages & chunks);
Block getBlockWithVirtualColumns(const Storages & selected_tables) const;
typedef std::set<std::string> TableNames;
/// Какие таблицы типа Chunks сейчас пишет хоть один ChunkMerger.
/// Нужно смотреть, залочив mutex из контекста.

View File

@ -14,13 +14,13 @@ class StorageChunkRef : public IStorage
public:
static StoragePtr create(const std::string & name_, const Context & context_, const std::string & source_database_name_, const std::string & source_table_name_, bool attach);
std::string getName() const { return "ChunkRef"; }
std::string getTableName() const { return name; }
std::string getName() const override { return "ChunkRef"; }
std::string getTableName() const override { return name; }
const NamesAndTypesList & getColumnsList() const { return getSource().getColumnsList(); }
const NamesAndTypesList & getColumnsList() const override { return getSource().getColumnsList(); }
/// В таблице, на которую мы ссылаемся, могут быть виртуальные столбцы.
NameAndTypePair getColumn(const String &column_name) const { return getSource().getColumn(column_name); };
bool hasColumn(const String &column_name) const { return getSource().hasColumn(column_name); };
NameAndTypePair getColumn(const String & column_name) const override { return getSource().getColumn(column_name); };
bool hasColumn(const String & column_name) const override { return getSource().hasColumn(column_name); };
BlockInputStreams read(
const Names & column_names,
@ -28,7 +28,7 @@ public:
const Settings & settings,
QueryProcessingStage::Enum & processed_stage,
size_t max_block_size = DEFAULT_BLOCK_SIZE,
unsigned threads = 1);
unsigned threads = 1) override;
ASTPtr getCustomCreateQuery(const Context & context) const;

View File

@ -29,7 +29,7 @@ public:
void addReference();
void removeReference();
std::string getName() const { return "Chunks"; }
std::string getName() const override { return "Chunks"; }
BlockInputStreams read(
const Names & column_names,
@ -37,7 +37,7 @@ public:
const Settings & settings,
QueryProcessingStage::Enum & processed_stage,
size_t max_block_size = DEFAULT_BLOCK_SIZE,
unsigned threads = 1);
unsigned threads = 1) override;
BlockInputStreams readFromChunk(
const std::string & chunk_name,
@ -48,27 +48,24 @@ public:
size_t max_block_size = DEFAULT_BLOCK_SIZE,
unsigned threads = 1);
NameAndTypePair getColumn(const String &column_name) const;
bool hasColumn(const String &column_name) const;
NameAndTypePair getColumn(const String & column_name) const override;
bool hasColumn(const String & column_name) const override;
BlockOutputStreamPtr writeToNewChunk(
const std::string & chunk_name);
/// Если бы запись была разрешена, непонятно, как назвать новый чанк.
BlockOutputStreamPtr write(
ASTPtr query)
BlockOutputStreamPtr write(ASTPtr query) override
{
throw Exception("Table doesn't support writing", ErrorCodes::NOT_IMPLEMENTED);
}
/// Переименование испортило бы целостность количества ссылок из таблиц ChunkRef.
void rename(const String & new_path_to_db, const String & new_database_name, const String & new_table_name)
void rename(const String & new_path_to_db, const String & new_database_name, const String & new_table_name) override
{
throw Exception("Table doesn't support renaming", ErrorCodes::NOT_IMPLEMENTED);
}
Block getBlockWithVirtualColumns() const;
protected:
/// Виртуальная функция из StorageLog
/// По номеру засечки получить имя таблицы, из которой идет чтение и номер последней засечки из этой таблицы.
@ -103,6 +100,8 @@ private:
void loadIndex();
void appendChunkToIndex(const std::string & chunk_name, size_t mark);
Block getBlockWithVirtualColumns() const;
};
}

View File

@ -40,19 +40,19 @@ public:
SharedPtr<Cluster> & owned_cluster_,
Context & context_);
std::string getName() const { return "Distributed"; }
std::string getTableName() const { return name; }
bool supportsSampling() const { return true; }
bool supportsFinal() const { return true; }
bool supportsPrewhere() const { return true; }
std::string getName() const override { return "Distributed"; }
std::string getTableName() const override { return name; }
bool supportsSampling() const override { return true; }
bool supportsFinal() const override { return true; }
bool supportsPrewhere() const override { return true; }
const NamesAndTypesList & getColumnsList() const { return *columns; }
NameAndTypePair getColumn(const String &column_name) const;
bool hasColumn(const String &column_name) const;
const NamesAndTypesList & getColumnsList() const override { return *columns; }
NameAndTypePair getColumn(const String & column_name) const override;
bool hasColumn(const String & column_name) const override;
bool isRemote() const { return true; }
bool isRemote() const override { return true; }
/// Сохранить временные таблицы, чтобы при следующем вызове метода read переслать их на удаленные серверы.
void storeExternalTables(const Tables & tables_) { external_tables = tables_; }
void storeExternalTables(const Tables & tables_) override { external_tables = tables_; }
BlockInputStreams read(
const Names & column_names,
@ -60,15 +60,15 @@ public:
const Settings & settings,
QueryProcessingStage::Enum & processed_stage,
size_t max_block_size = DEFAULT_BLOCK_SIZE,
unsigned threads = 1);
unsigned threads = 1) override;
BlockOutputStreamPtr write(ASTPtr query) override;
void drop() override {}
void rename(const String & new_path_to_db, const String & new_database_name, const String & new_table_name) { name = new_table_name; }
void rename(const String & new_path_to_db, const String & new_database_name, const String & new_table_name) override { name = new_table_name; }
/// в подтаблицах добавлять и удалять столбы нужно вручную
/// структура подтаблиц не проверяется
void alter(const AlterCommands & params, const String & database_name, const String & table_name, Context & context);
void alter(const AlterCommands & params, const String & database_name, const String & table_name, Context & context) override;
void shutdown() override;

View File

@ -139,12 +139,16 @@ public:
* (корректность имён и путей не проверяется)
* состоящую из указанных столбцов; создать файлы, если их нет.
*/
static StoragePtr create(const std::string & path_, const std::string & name_, NamesAndTypesListPtr columns_, size_t max_compress_block_size_ = DEFAULT_MAX_COMPRESS_BLOCK_SIZE);
static StoragePtr create(
const std::string & path_,
const std::string & name_,
NamesAndTypesListPtr columns_,
size_t max_compress_block_size_ = DEFAULT_MAX_COMPRESS_BLOCK_SIZE);
std::string getName() const { return "Log"; }
std::string getTableName() const { return name; }
std::string getName() const override { return "Log"; }
std::string getTableName() const override { return name; }
const NamesAndTypesList & getColumnsList() const { return *columns; }
const NamesAndTypesList & getColumnsList() const override { return *columns; }
virtual BlockInputStreams read(
const Names & column_names,
@ -152,12 +156,11 @@ public:
const Settings & settings,
QueryProcessingStage::Enum & processed_stage,
size_t max_block_size = DEFAULT_BLOCK_SIZE,
unsigned threads = 1);
unsigned threads = 1) override;
BlockOutputStreamPtr write(
ASTPtr query);
BlockOutputStreamPtr write(ASTPtr query) override;
void rename(const String & new_path_to_db, const String & new_database_name, const String & new_table_name);
void rename(const String & new_path_to_db, const String & new_database_name, const String & new_table_name) override;
/// Данные столбца
struct ColumnData

View File

@ -12,15 +12,15 @@ public:
static StoragePtr create(const String & table_name_, const String & database_name_,
Context & context_, ASTPtr & query_, NamesAndTypesListPtr columns_, bool attach_);
std::string getName() const { return "MaterializedView"; }
std::string getName() const override { return "MaterializedView"; }
std::string getInnerTableName() const { return ".inner." + table_name; }
NameAndTypePair getColumn(const String &column_name) const;
bool hasColumn(const String &column_name) const;
NameAndTypePair getColumn(const String & column_name) const override;
bool hasColumn(const String & column_name) const override;
BlockOutputStreamPtr write(ASTPtr query);
BlockOutputStreamPtr write(ASTPtr query) override;
void drop() override;
bool optimize();
bool optimize() override;
BlockInputStreams read(
const Names & column_names,
@ -28,14 +28,13 @@ public:
const Settings & settings,
QueryProcessingStage::Enum & processed_stage,
size_t max_block_size = DEFAULT_BLOCK_SIZE,
unsigned threads = 1);
unsigned threads = 1) override;
private:
StoragePtr data;
StorageMaterializedView(const String & table_name_, const String & database_name_,
Context & context_, ASTPtr & query_, NamesAndTypesListPtr columns_, bool attach_);
};
}

View File

@ -64,10 +64,10 @@ friend class MemoryBlockOutputStream;
public:
static StoragePtr create(const std::string & name_, NamesAndTypesListPtr columns_);
std::string getName() const { return "Memory"; }
std::string getTableName() const { return name; }
std::string getName() const override { return "Memory"; }
std::string getTableName() const override { return name; }
const NamesAndTypesList & getColumnsList() const { return *columns; }
const NamesAndTypesList & getColumnsList() const override { return *columns; }
size_t getSize() const { return data.size(); }
@ -77,13 +77,12 @@ public:
const Settings & settings,
QueryProcessingStage::Enum & processed_stage,
size_t max_block_size = DEFAULT_BLOCK_SIZE,
unsigned threads = 1);
unsigned threads = 1) override;
BlockOutputStreamPtr write(
ASTPtr query);
BlockOutputStreamPtr write(ASTPtr query) override;
void drop() override;
void rename(const String & new_path_to_db, const String & new_database_name, const String & new_table_name) { name = new_table_name; }
void rename(const String & new_path_to_db, const String & new_database_name, const String & new_table_name) override { name = new_table_name; }
private:
String name;

View File

@ -25,16 +25,16 @@ public:
const String & table_name_regexp_, /// Регексп имён таблиц-источников.
const Context & context_); /// Известные таблицы.
std::string getName() const { return "Merge"; }
std::string getTableName() const { return name; }
bool supportsSampling() const { return true; }
std::string getName() const override { return "Merge"; }
std::string getTableName() const override { return name; }
bool supportsSampling() const override { return true; }
/// Проверка откладывается до метода read. Там проверяется поддержка PREWHERE у использующихся таблиц.
bool supportsPrewhere() const { return true; }
bool supportsPrewhere() const override { return true; }
const NamesAndTypesList & getColumnsList() const { return *columns; }
NameAndTypePair getColumn(const String &column_name) const;
bool hasColumn(const String &column_name) const;
const NamesAndTypesList & getColumnsList() const override { return *columns; }
NameAndTypePair getColumn(const String & column_name) const override;
bool hasColumn(const String & column_name) const override;
BlockInputStreams read(
const Names & column_names,
@ -42,16 +42,15 @@ public:
const Settings & settings,
QueryProcessingStage::Enum & processed_stage,
size_t max_block_size = DEFAULT_BLOCK_SIZE,
unsigned threads = 1);
unsigned threads = 1) override;
void drop() override {}
void rename(const String & new_path_to_db, const String & new_database_name, const String & new_table_name) { name = new_table_name; }
void rename(const String & new_path_to_db, const String & new_database_name, const String & new_table_name) override { name = new_table_name; }
/// в подтаблицах добавлять и удалять столбы нужно вручную
/// структура подтаблиц не проверяется
void alter(const AlterCommands & params, const String & database_name, const String & table_name, Context & context);
void alter(const AlterCommands & params, const String & database_name, const String & table_name, Context & context) override;
Block getBlockWithVirtualColumns(const std::vector<StoragePtr> & selected_tables) const;
private:
String name;
NamesAndTypesListPtr columns;
@ -67,6 +66,8 @@ private:
const Context & context_);
void getSelectedTables(StorageVector & selected_tables) const;
Block getBlockWithVirtualColumns(const StorageVector & selected_tables) const;
};
}

View File

@ -35,27 +35,27 @@ public:
const String & sign_column_ = "",
const MergeTreeSettings & settings_ = MergeTreeSettings());
void shutdown();
~StorageMergeTree();
void shutdown() override;
~StorageMergeTree() override;
std::string getName() const
std::string getName() const override
{
return data.getModePrefix() + "MergeTree";
}
std::string getTableName() const { return table_name; }
bool supportsSampling() const { return data.supportsSampling(); }
bool supportsFinal() const { return data.supportsFinal(); }
bool supportsPrewhere() const { return data.supportsPrewhere(); }
std::string getTableName() const override { return table_name; }
bool supportsSampling() const override { return data.supportsSampling(); }
bool supportsFinal() const override { return data.supportsFinal(); }
bool supportsPrewhere() const override { return data.supportsPrewhere(); }
const NamesAndTypesList & getColumnsList() const { return data.getColumnsList(); }
const NamesAndTypesList & getColumnsList() const override { return data.getColumnsList(); }
NameAndTypePair getColumn(const String &column_name) const
NameAndTypePair getColumn(const String & column_name) const override
{
return data.getColumn(column_name);
}
bool hasColumn(const String &column_name) const
bool hasColumn(const String & column_name) const override
{
return data.hasColumn(column_name);
}
@ -66,22 +66,22 @@ public:
const Settings & settings,
QueryProcessingStage::Enum & processed_stage,
size_t max_block_size = DEFAULT_BLOCK_SIZE,
unsigned threads = 1);
unsigned threads = 1) override;
BlockOutputStreamPtr write(ASTPtr query);
BlockOutputStreamPtr write(ASTPtr query) override;
/** Выполнить очередной шаг объединения кусков.
*/
bool optimize()
bool optimize() override
{
return merge(true);
}
void drop() override;
void rename(const String & new_path_to_db, const String & new_database_name, const String & new_table_name);
void rename(const String & new_path_to_db, const String & new_database_name, const String & new_table_name) override;
void alter(const AlterCommands & params, const String & database_name, const String & table_name, Context & context);
void alter(const AlterCommands & params, const String & database_name, const String & table_name, Context & context) override;
bool supportsIndexForIn() const override { return true; }

View File

@ -20,10 +20,10 @@ public:
return (new StorageNull(name_, columns_))->thisPtr();
}
std::string getName() const { return "Null"; }
std::string getTableName() const { return name; }
std::string getName() const override { return "Null"; }
std::string getTableName() const override { return name; }
const NamesAndTypesList & getColumnsList() const { return *columns; }
const NamesAndTypesList & getColumnsList() const override { return *columns; }
BlockInputStreams read(
const Names & column_names,
@ -31,18 +31,17 @@ public:
const Settings & settings,
QueryProcessingStage::Enum & processed_stage,
size_t max_block_size = DEFAULT_BLOCK_SIZE,
unsigned threads = 1)
unsigned threads = 1) override
{
return { new NullBlockInputStream };
}
BlockOutputStreamPtr write(
ASTPtr query)
BlockOutputStreamPtr write(ASTPtr query) override
{
return new NullBlockOutputStream;
}
void rename(const String & new_path_to_db, const String & new_database_name, const String & new_table_name) { name = new_table_name; }
void rename(const String & new_path_to_db, const String & new_database_name, const String & new_table_name) override { name = new_table_name; }
private:
String name;

View File

@ -38,7 +38,7 @@ public:
const MergeTreeSettings & settings_ = MergeTreeSettings());
void shutdown() override;
~StorageReplicatedMergeTree();
~StorageReplicatedMergeTree() override;
std::string getName() const override
{
@ -52,13 +52,13 @@ public:
const NamesAndTypesList & getColumnsList() const override { return data.getColumnsList(); }
NameAndTypePair getColumn(const String &column_name) const
NameAndTypePair getColumn(const String & column_name) const override
{
if (column_name == "_replicated") return NameAndTypePair("_replicated", new DataTypeUInt8);
return data.getColumn(column_name);
}
bool hasColumn(const String &column_name) const
bool hasColumn(const String & column_name) const override
{
if (column_name == "_replicated") return true;
return data.hasColumn(column_name);
@ -85,7 +85,7 @@ public:
*/
void drop() override;
void rename(const String & new_path_to_db, const String & new_database_name, const String & new_table_name);
void rename(const String & new_path_to_db, const String & new_database_name, const String & new_table_name) override;
bool supportsIndexForIn() const override { return true; }

View File

@ -20,10 +20,10 @@ class StorageSystemDatabases : public IStorage
public:
static StoragePtr create(const std::string & name_, const Context & context_);
std::string getName() const { return "SystemDatabases"; }
std::string getTableName() const { return name; }
std::string getName() const override { return "SystemDatabases"; }
std::string getTableName() const override { return name; }
const NamesAndTypesList & getColumnsList() const { return columns; }
const NamesAndTypesList & getColumnsList() const override { return columns; }
BlockInputStreams read(
const Names & column_names,
@ -31,7 +31,7 @@ public:
const Settings & settings,
QueryProcessingStage::Enum & processed_stage,
size_t max_block_size = DEFAULT_BLOCK_SIZE,
unsigned threads = 1);
unsigned threads = 1) override;
private:
const std::string name;

View File

@ -19,10 +19,10 @@ class StorageSystemEvents : public IStorage
public:
static StoragePtr create(const std::string & name_);
std::string getName() const { return "SystemEvents"; }
std::string getTableName() const { return name; }
std::string getName() const override { return "SystemEvents"; }
std::string getTableName() const override { return name; }
const NamesAndTypesList & getColumnsList() const { return columns; }
const NamesAndTypesList & getColumnsList() const override { return columns; }
BlockInputStreams read(
const Names & column_names,
@ -30,7 +30,7 @@ public:
const Settings & settings,
QueryProcessingStage::Enum & processed_stage,
size_t max_block_size = DEFAULT_BLOCK_SIZE,
unsigned threads = 1);
unsigned threads = 1) override;
private:
const std::string name;

View File

@ -20,10 +20,10 @@ class StorageSystemNumbers : public IStorage
public:
static StoragePtr create(const std::string & name_, bool multithreaded_ = false);
std::string getName() const { return "SystemNumbers"; }
std::string getTableName() const { return name; }
std::string getName() const override { return "SystemNumbers"; }
std::string getTableName() const override { return name; }
const NamesAndTypesList & getColumnsList() const { return columns; }
const NamesAndTypesList & getColumnsList() const override { return columns; }
BlockInputStreams read(
const Names & column_names,
@ -31,7 +31,7 @@ public:
const Settings & settings,
QueryProcessingStage::Enum & processed_stage,
size_t max_block_size = DEFAULT_BLOCK_SIZE,
unsigned threads = 1);
unsigned threads = 1) override;
private:
const std::string name;

View File

@ -17,10 +17,10 @@ class StorageSystemOne : public IStorage
public:
static StoragePtr create(const std::string & name_);
std::string getName() const { return "SystemOne"; }
std::string getTableName() const { return name; }
std::string getName() const override { return "SystemOne"; }
std::string getTableName() const override { return name; }
const NamesAndTypesList & getColumnsList() const { return columns; }
const NamesAndTypesList & getColumnsList() const override { return columns; }
BlockInputStreams read(
const Names & column_names,
@ -28,7 +28,7 @@ public:
const Settings & settings,
QueryProcessingStage::Enum & processed_stage,
size_t max_block_size = DEFAULT_BLOCK_SIZE,
unsigned threads = 1);
unsigned threads = 1) override;
private:
const std::string name;

View File

@ -19,10 +19,10 @@ class StorageSystemParts : public IStorage
public:
static StoragePtr create(const std::string & name_, const Context & context_);
std::string getName() const { return "SystemParts"; }
std::string getTableName() const { return name; }
std::string getName() const override{ return "SystemParts"; }
std::string getTableName() const override { return name; }
const NamesAndTypesList & getColumnsList() const { return columns; }
const NamesAndTypesList & getColumnsList() const override { return columns; }
BlockInputStreams read(
const Names & column_names,
@ -30,7 +30,7 @@ public:
const Settings & settings,
QueryProcessingStage::Enum & processed_stage,
size_t max_block_size = DEFAULT_BLOCK_SIZE,
unsigned threads = 1);
unsigned threads = 1) override;
private:
const std::string name;

View File

@ -20,10 +20,10 @@ class StorageSystemProcesses : public IStorage
public:
static StoragePtr create(const std::string & name_, const Context & context_);
std::string getName() const { return "SystemProcesses"; }
std::string getTableName() const { return name; }
std::string getName() const override { return "SystemProcesses"; }
std::string getTableName() const override { return name; }
const NamesAndTypesList & getColumnsList() const { return columns; }
const NamesAndTypesList & getColumnsList() const override { return columns; }
BlockInputStreams read(
const Names & column_names,
@ -31,7 +31,7 @@ public:
const Settings & settings,
QueryProcessingStage::Enum & processed_stage,
size_t max_block_size = DEFAULT_BLOCK_SIZE,
unsigned threads = 1);
unsigned threads = 1) override;
private:
const std::string name;

View File

@ -20,10 +20,10 @@ class StorageSystemTables : public IStorage
public:
static StoragePtr create(const std::string & name_, const Context & context_);
std::string getName() const { return "SystemTables"; }
std::string getTableName() const { return name; }
std::string getName() const override { return "SystemTables"; }
std::string getTableName() const override { return name; }
const NamesAndTypesList & getColumnsList() const { return columns; }
const NamesAndTypesList & getColumnsList() const override { return columns; }
BlockInputStreams read(
const Names & column_names,
@ -31,7 +31,7 @@ public:
const Settings & settings,
QueryProcessingStage::Enum & processed_stage,
size_t max_block_size = DEFAULT_BLOCK_SIZE,
unsigned threads = 1);
unsigned threads = 1) override;
private:
const std::string name;

View File

@ -111,12 +111,17 @@ public:
* состоящую из указанных столбцов.
* Если не указано attach - создать директорию, если её нет.
*/
static StoragePtr create(const std::string & path_, const std::string & name_, NamesAndTypesListPtr columns_, bool attach, size_t max_compress_block_size_ = DEFAULT_MAX_COMPRESS_BLOCK_SIZE);
static StoragePtr create(
const std::string & path_,
const std::string & name_,
NamesAndTypesListPtr columns_,
bool attach,
size_t max_compress_block_size_ = DEFAULT_MAX_COMPRESS_BLOCK_SIZE);
std::string getName() const { return "TinyLog"; }
std::string getTableName() const { return name; }
std::string getName() const override { return "TinyLog"; }
std::string getTableName() const override { return name; }
const NamesAndTypesList & getColumnsList() const { return *columns; }
const NamesAndTypesList & getColumnsList() const override { return *columns; }
BlockInputStreams read(
const Names & column_names,
@ -124,14 +129,13 @@ public:
const Settings & settings,
QueryProcessingStage::Enum & processed_stage,
size_t max_block_size = DEFAULT_BLOCK_SIZE,
unsigned threads = 1);
unsigned threads = 1) override;
BlockOutputStreamPtr write(
ASTPtr query);
BlockOutputStreamPtr write(ASTPtr query) override;
void drop() override;
void rename(const String & new_path_to_db, const String & new_database_name, const String & new_table_name);
void rename(const String & new_path_to_db, const String & new_database_name, const String & new_table_name) override;
bool checkData() const override;

View File

@ -13,9 +13,9 @@ public:
static StoragePtr create(const String & table_name_, const String & database_name_,
Context & context_, ASTPtr & query_, NamesAndTypesListPtr columns_);
virtual std::string getName() const { return "View"; }
virtual std::string getTableName() const { return table_name; }
const NamesAndTypesList & getColumnsList() const { return *columns; }
virtual std::string getName() const override { return "View"; }
virtual std::string getTableName() const override { return table_name; }
const NamesAndTypesList & getColumnsList() const override { return *columns; }
DB::ASTPtr getInnerQuery() const { return inner_query.clone(); };
virtual BlockInputStreams read(
@ -24,7 +24,7 @@ public:
const Settings & settings,
QueryProcessingStage::Enum & processed_stage,
size_t max_block_size = DEFAULT_BLOCK_SIZE,
unsigned threads = 1);
unsigned threads = 1) override;
virtual void drop() override;

View File

@ -39,13 +39,14 @@ StoragePtr StorageChunkMerger::create(
return (new StorageChunkMerger(this_database_, name_, columns_, source_database_, table_name_regexp_, destination_name_prefix_, chunks_to_merge_, context_))->thisPtr();
}
NameAndTypePair StorageChunkMerger::getColumn(const String &column_name) const
NameAndTypePair StorageChunkMerger::getColumn(const String & column_name) const
{
if (column_name == _table_column_name) return NameAndTypePair(_table_column_name, new DataTypeString);
if (column_name == _table_column_name)
return NameAndTypePair(_table_column_name, new DataTypeString);
return getRealColumn(column_name);
}
bool StorageChunkMerger::hasColumn(const String &column_name) const
bool StorageChunkMerger::hasColumn(const String & column_name) const
{
if (column_name == _table_column_name) return true;
return hasRealColumn(column_name);

View File

@ -162,15 +162,17 @@ StorageChunks::StorageChunks(
_table_column_name = "_table" + VirtualColumnUtils::chooseSuffix(getColumnsList(), "_table");
}
NameAndTypePair StorageChunks::getColumn(const String &column_name) const
NameAndTypePair StorageChunks::getColumn(const String & column_name) const
{
if (column_name == _table_column_name) return NameAndTypePair(_table_column_name, new DataTypeString);
if (column_name == _table_column_name)
return NameAndTypePair(_table_column_name, new DataTypeString);
return getRealColumn(column_name);
}
bool StorageChunks::hasColumn(const String &column_name) const
bool StorageChunks::hasColumn(const String & column_name) const
{
if (column_name == _table_column_name) return true;
if (column_name == _table_column_name)
return true;
return hasRealColumn(column_name);
}