ClickHouse/src/Interpreters/TreeOptimizer.h

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

32 lines
918 B
C++
Raw Normal View History

#pragma once
#include <Interpreters/Aliases.h>
#include <Interpreters/Context_fwd.h>
#include <Interpreters/DatabaseAndTableWithAlias.h>
2021-04-24 15:24:32 +00:00
#include <Storages/IStorage_fwd.h>
#include <Parsers/IAST_fwd.h>
namespace DB
{
2021-05-21 18:48:19 +00:00
struct TreeRewriterResult;
/// Part of of Tree Rewriter (SyntaxAnalyzer) that optimizes AST.
/// Query should be ready to execute either before either after it. But resulting query could be faster.
class TreeOptimizer
{
public:
static void apply(
ASTPtr & query,
2021-05-21 18:48:19 +00:00
TreeRewriterResult & result,
const std::vector<TableWithColumnNamesAndTypes> & tables_with_columns,
ContextPtr context);
static void optimizeIf(ASTPtr & query, Aliases & aliases, bool if_chain_to_multiif, bool multiif_to_if);
static void optimizeCountConstantAndSumOne(ASTPtr & query, ContextPtr context);
2022-11-29 17:22:24 +00:00
static void optimizeGroupByFunctionKeys(ASTSelectQuery * select_query);
};
}