2021-04-24 15:24:32 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Parsers/IAST_fwd.h>
|
|
|
|
#include <Core/Block.h>
|
|
|
|
#include <Core/NamesAndTypes.h>
|
|
|
|
#include <Interpreters/Aliases.h>
|
|
|
|
#include <Interpreters/SelectQueryOptions.h>
|
|
|
|
#include <Interpreters/DatabaseAndTableWithAlias.h>
|
|
|
|
#include <Storages/IStorage_fwd.h>
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
struct StorageInMemoryMetadata;
|
|
|
|
using StorageMetadataPtr = std::shared_ptr<const StorageInMemoryMetadata>;
|
|
|
|
|
2021-11-10 17:57:59 +00:00
|
|
|
/// Optimizer that tries to replace columns to equal columns (according to constraints)
|
2024-02-21 02:48:32 +00:00
|
|
|
/// with lower size (according to compressed and uncomressed size).
|
2021-04-24 15:24:32 +00:00
|
|
|
class SubstituteColumnOptimizer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SubstituteColumnOptimizer(
|
2021-05-04 18:43:58 +00:00
|
|
|
ASTSelectQuery * select_query,
|
|
|
|
const StorageMetadataPtr & metadata_snapshot,
|
|
|
|
const ConstStoragePtr & storage);
|
2021-04-24 15:24:32 +00:00
|
|
|
|
|
|
|
void perform();
|
|
|
|
|
|
|
|
private:
|
|
|
|
ASTSelectQuery * select_query;
|
|
|
|
const StorageMetadataPtr & metadata_snapshot;
|
|
|
|
ConstStoragePtr storage;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|